-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
/
Copy pathcss.js
41 lines (35 loc) · 1.17 KB
/
css.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
35
36
37
38
39
40
41
const fs = require('fs')
const path = require('path')
const {spawn} = require('child_process')
const args = process.argv.slice(2)
fs.readdir(path.join(__dirname, '../src/themes'), (err, files) => {
if (err) {
console.log('err', err)
return
}
files.map(async (file) => {
if (/\.styl/g.test(file)) {
var stylusCMD;
const stylusBin = ['node_modules', 'stylus', 'bin', 'stylus'].join(path.sep)
var cmdargs = [
stylusBin,
`src/themes/${file}`,
'-u',
'autoprefixer-stylus'
]
cmdargs = cmdargs.concat(args)
stylusCMD = spawn('node', cmdargs, { shell: true })
stylusCMD.stdout.on('data', (data) => {
console.log(`[Stylus Build ] stdout: ${data}`);
});
stylusCMD.stderr.on('data', (data) => {
console.error(`[Stylus Build ] stderr: ${data}`);
});
stylusCMD.on('close', (code) => {
console.log(`[Stylus Build ] child process exited with code ${code}`);
});
} else {
return
}
})
})