-
Notifications
You must be signed in to change notification settings - Fork 0
/
css
48 lines (43 loc) · 885 Bytes
/
css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env node
var
fs = require('fs-extra')
;
css();
function css() {
var
inFile = 'src/css/style.scss',
outFile = 'dist/public/css/style.css',
sass = require('node-sass'),
postcss = require('postcss')
;
console.log('Processing ' + inFile);
console.log('Sass...');
sass.render(
{
file: inFile
},
function(err, result) {
if (err) {
console.log(err);
}
else {
console.log('Autoprefixer...');
postcss([
require('autoprefixer-core')()
])
.process(result.css, {
})
.then(function(result) {
console.log('CleanCSS...')
var CleanCSS = require('clean-css');
var minifiedCSS = new CleanCSS().minify(result.css).styles;
fs.outputFileSync(outFile, minifiedCSS); //fs.writeFileSync('dist/style.css', result.css);
})
.catch(function() {
console.log(arguments);
})
;
}
}
);
}