diff --git a/bin/build-sass.js b/bin/build-sass.js index 5c80424..9c62c00 100755 --- a/bin/build-sass.js +++ b/bin/build-sass.js @@ -34,18 +34,21 @@ function doWatch () { chokidar.watch() } -async function compileGlobalSass () { - let results = await Promise.all([ - render({ file: defaultThemeScss, outputStyle: 'compressed' }), - render({ file: globalScss, outputStyle: 'compressed' }), - render({ file: offlineThemeScss, outputStyle: 'compressed' }) - ]) +async function renderCss (file) { + return (await render({ file, outputStyle: 'compressed' })).css +} - let css = results.map(_ => _.css).join('') +async function compileGlobalSass () { + let mainStyle = (await Promise.all([defaultThemeScss, globalScss].map(renderCss))).join('') + let offlineStyle = (await renderCss(offlineThemeScss)) let html = await readFile(html2xxFile, 'utf8') - html = html.replace(/`) + html = html.replace(/[\s\S]+/, + `\n` + + `\n` + + `\n` + + `` + ) await writeFile(html2xxFile, html, 'utf8') } diff --git a/inline-script.js b/inline-script.js index 6af6cd7..3d76f45 100644 --- a/inline-script.js +++ b/inline-script.js @@ -7,11 +7,11 @@ if (localStorage.store_currentInstance && localStorage.store_instanceThemes) { let safeParse = (str) => str === 'undefined' ? undefined : JSON.parse(str) let theme = safeParse(localStorage.store_instanceThemes)[safeParse(localStorage.store_currentInstance)] if (theme && theme !== 'default') { - document.body.classList.add(`theme-${theme}`) let link = document.createElement('link') link.rel = 'stylesheet' link.href = `/theme-${theme}.css` - document.head.appendChild(link) + // inserting before the offline + +