feat(riot-v5): create the skeleton for riot5

This commit is contained in:
Joxit 2021-03-01 23:55:32 +01:00
parent 307e171ede
commit cde932ec17
No known key found for this signature in database
GPG key ID: F526592B8E012263
7 changed files with 125 additions and 25 deletions

21
rollup/html-useref.js Normal file
View 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;
}