Skip to content

Commit 4a8f2c5

Browse files
committed
chore: fixed the npm script and added css build file
1 parent 79f8211 commit 4a8f2c5

File tree

5 files changed

+363
-104
lines changed

5 files changed

+363
-104
lines changed

Diff for: .vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"prettier.eslintIntegration": true
2+
"editor.defaultFormatter": "esbenp.prettier-vscode",
3+
"editor.formatOnSave": true
34
}

Diff for: build/css.js

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
const fs = require('fs')
2+
const path = require('path')
3+
const {spawn} = require('child_process')
4+
5+
const args = process.argv.slice(2)
6+
fs.readdir(path.join(__dirname, '../src/themes'), (err, files) => {
7+
if (err) {
8+
console.log('err', err)
9+
return
10+
}
11+
files.map(async (file) => {
12+
if (/\.styl/g.test(file)) {
13+
var stylusCMD;
14+
const stylusBin = ['node_modules', 'stylus', 'bin', 'stylus'].join(path.sep)
15+
var cmdargs = [
16+
stylusBin,
17+
`src/themes/${file}`,
18+
'-u',
19+
'autoprefixer-stylus'
20+
]
21+
cmdargs = cmdargs.concat(args)
22+
23+
stylusCMD = spawn('node', cmdargs, { shell: true })
24+
25+
stylusCMD.stdout.on('data', (data) => {
26+
console.log(`[Stylus Build ] stdout: ${data}`);
27+
});
28+
29+
stylusCMD.stderr.on('data', (data) => {
30+
console.error(`[Stylus Build ] stderr: ${data}`);
31+
});
32+
33+
stylusCMD.on('close', (code) => {
34+
console.log(`[Stylus Build ] child process exited with code ${code}`);
35+
});
36+
} else {
37+
return
38+
}
39+
40+
})
41+
})

0 commit comments

Comments
 (0)