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');
|
|
|
|
|
|
|
|
const css = fs.readFileSync('css/base.css', 'utf8');
|
|
|
|
|
|
|
|
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, {
|
|
|
|
from: 'css/base.css',
|
|
|
|
to: 'css/app.min.css'
|
|
|
|
}).then(result => {
|
|
|
|
fs.writeFileSync('css/app.min.css', result.css);
|
|
|
|
fs.writeFileSync('css/app.min.css.map', result.map);
|
|
|
|
});
|