mirror of
https://github.com/Joxit/docker-registry-ui.git
synced 2025-04-28 07:59:55 +03:00
feat: merge static version with latest and add license
BREAKING CHANGE: Now only one tag will be published: `latest`. This tag will include both the standard and latest version
This commit is contained in:
parent
7d095916db
commit
1173453f72
24 changed files with 151 additions and 288 deletions
|
@ -1,21 +1,26 @@
|
|||
import fs from 'fs';
|
||||
|
||||
const useref = /<!--\s*build:([a-z]+) ([-a-zA-Z./]+)\s*-->.*?<!--\s*endbuild\s*-->/;
|
||||
const useref = /<!--\s*build:([a-z]+) ([-a-zA-Z./]+)\s*-->(.*?)<!--\s*endbuild\s*-->/ms;
|
||||
|
||||
const generateBalise = (type, output) => {
|
||||
switch(type) {
|
||||
const generateBalise = (type, output, body, opts = {}) => {
|
||||
switch (type) {
|
||||
case 'css':
|
||||
return `<link href="${output}" rel="stylesheet" type="text/css">`;
|
||||
case 'js':
|
||||
return `<script src="${output}"></script>`
|
||||
return `<script src="${output}"></script>`;
|
||||
case 'keep':
|
||||
return opts[output] ? body : '';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default function(src) {
|
||||
let html = fs.readFileSync(src).toString().replace(/>\n+\s*/g, '>');
|
||||
export default function (src, opts) {
|
||||
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));
|
||||
const [raw, type, output, body] = useref.exec(html);
|
||||
html = html.replace(raw, generateBalise(type, output, body, opts));
|
||||
}
|
||||
return html;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue