2017-04-06 11:45:25 -04:00
|
|
|
/**
|
|
|
|
* Script for optimizing css
|
|
|
|
*/
|
|
|
|
const fs = require('fs');
|
|
|
|
const postcss = require('postcss');
|
|
|
|
const atImport = require('postcss-import');
|
|
|
|
const cssNext = require('postcss-cssnext');
|
|
|
|
const cssNano = require('cssnano');
|
|
|
|
|
2018-11-05 09:47:05 -05:00
|
|
|
const css = fs.readFileSync('css/all.css', 'utf-8');
|
2018-12-06 13:04:54 -05:00
|
|
|
const darkCss = fs.readFileSync('css/dark-override.css', 'utf-8');
|
2017-04-06 11:45:25 -04:00
|
|
|
|
2018-12-06 13:04:54 -05:00
|
|
|
// Basic theme
|
2017-04-06 11:45:25 -04:00
|
|
|
postcss()
|
|
|
|
.use(atImport())
|
2017-04-13 11:15:16 -04:00
|
|
|
.use(cssNext())
|
2017-04-06 11:45:25 -04:00
|
|
|
.use(cssNano({
|
2017-04-13 11:15:16 -04:00
|
|
|
autoprefixer: false,
|
|
|
|
colormin: false,
|
|
|
|
minifyFontValues: false,
|
2017-04-06 11:45:25 -04:00
|
|
|
options: {
|
|
|
|
sourcemap: false
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
.process(css, {
|
2018-11-05 09:47:05 -05:00
|
|
|
from: 'css/all.css',
|
2017-04-06 11:45:25 -04:00
|
|
|
to: 'css/app.min.css'
|
|
|
|
}).then(result => {
|
2018-12-06 13:04:54 -05:00
|
|
|
fs.writeFileSync('css/app.min.css', result.css);
|
|
|
|
});
|
|
|
|
|
|
|
|
// Dark theme
|
|
|
|
postcss()
|
|
|
|
.use(atImport())
|
|
|
|
.use(cssNext())
|
|
|
|
.use(cssNano({
|
|
|
|
autoprefixer: false,
|
|
|
|
colormin: false,
|
|
|
|
minifyFontValues: false,
|
|
|
|
options: {
|
|
|
|
sourcemap: false
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
.process(darkCss, {
|
|
|
|
from: 'css/dark-override.css',
|
|
|
|
to: 'css/dark.min.css'
|
|
|
|
}).then(result => {
|
|
|
|
fs.writeFileSync('css/dark.min.css', result.css);
|
|
|
|
});
|