forked from Mermade/shins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildstyle.js
34 lines (28 loc) · 1 KB
/
buildstyle.js
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
#!/bin/env node
'use strict';
const fs = require('fs');
const path = require('path');
const sass = require('node-sass');
const assetFunctions = require('node-sass-asset-functions');
const options = require('tiny-opts-parser')(process.argv);
const outputStyle = options._.length > 2 ? options._[2] : 'nested';
if (options.r) options.root = options.r;
if (!options.root) options.root = '.';
function sassRender(infile,outfile) {
sass.render({
file: infile,
outputStyle : outputStyle,
functions: assetFunctions({
http_fonts_path: '../../source/fonts'
})
}, function(err, result) {
if (err) console.error(err)
else {
fs.writeFile(outfile,result.css.toString(),'utf8',function(err){
if (err) console.warn(err.message);
});
}
});
}
sassRender(path.join(options.root,'source/stylesheets/screen.css.scss'),path.join(options.root,'pub/css/screen.css'));
sassRender(path.join(options.root,'source/stylesheets/print.css.scss'),path.join(options.root,'pub/css/print.css'));