forked from cybrespace/pinafore
emit theme scss as compressed
This commit is contained in:
parent
036dcf082f
commit
9643cfc9db
|
@ -22,7 +22,7 @@ const themesScssDir = path.join(__dirname, '../scss/themes')
|
||||||
const assetsDir = path.join(__dirname, '../assets')
|
const assetsDir = path.join(__dirname, '../assets')
|
||||||
|
|
||||||
function doWatch () {
|
function doWatch () {
|
||||||
var start = now()
|
let start = now()
|
||||||
chokidar.watch(scssDir).on('change', debounce(() => {
|
chokidar.watch(scssDir).on('change', debounce(() => {
|
||||||
console.log('Recompiling SCSS...')
|
console.log('Recompiling SCSS...')
|
||||||
Promise.all([
|
Promise.all([
|
||||||
|
@ -54,7 +54,7 @@ async function compileGlobalSass () {
|
||||||
async function compileThemesSass () {
|
async function compileThemesSass () {
|
||||||
let files = (await readdir(themesScssDir)).filter(file => !path.basename(file).startsWith('_'))
|
let files = (await readdir(themesScssDir)).filter(file => !path.basename(file).startsWith('_'))
|
||||||
await Promise.all(files.map(async file => {
|
await Promise.all(files.map(async file => {
|
||||||
let res = await render({file: path.join(themesScssDir, file)})
|
let res = await render({file: path.join(themesScssDir, file), outputStyle: 'compressed'})
|
||||||
let outputFilename = 'theme-' + path.basename(file).replace(/\.scss$/, '.css')
|
let outputFilename = 'theme-' + path.basename(file).replace(/\.scss$/, '.css')
|
||||||
await writeFile(path.join(assetsDir, outputFilename), res.css, 'utf8')
|
await writeFile(path.join(assetsDir, outputFilename), res.css, 'utf8')
|
||||||
}))
|
}))
|
||||||
|
|
Loading…
Reference in New Issue