mirror of
https://github.com/Joxit/docker-registry-ui.git
synced 2025-04-26 15:09:53 +03:00
feat(riot-v5): create the skeleton for riot5
This commit is contained in:
parent
307e171ede
commit
cde932ec17
7 changed files with 125 additions and 25 deletions
21
rollup/html-useref.js
Normal file
21
rollup/html-useref.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
import fs from 'fs';
|
||||
|
||||
const useref = /<!--\s*build:([a-z]+) ([-a-zA-Z./]+)\s*-->.*?<!--\s*endbuild\s*-->/;
|
||||
|
||||
const generateBalise = (type, output) => {
|
||||
switch(type) {
|
||||
case 'css':
|
||||
return `<link href="${output}" rel="stylesheet" type="text/css">`;
|
||||
case 'js':
|
||||
return `<script src="${output}"></script>`
|
||||
}
|
||||
}
|
||||
|
||||
export default function(src) {
|
||||
let html = fs.readFileSync(src).toString().replace(/>\n+\s*/g, '>');
|
||||
while (useref.test(html)) {
|
||||
const [ raw, type, output ] = useref.exec(html);
|
||||
html = html.replace(raw, generateBalise(type, output));
|
||||
}
|
||||
return html;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue