Skip to content

Commit f3efb36

Browse files
committed
perf(cli): update create configuration
1 parent 2796587 commit f3efb36

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

cli.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,23 @@ var argv = require('yargs')
3838
function processing(file, output) {
3939
// get htmls
4040
var html = fs.readFileSync(file, 'utf8')
41-
var ext = {}
41+
42+
// config
43+
var config = {}
4244

4345
// create config extends for post-load-plugins
4446
if (argv.use) {
4547
argv.use.forEach(function (plugin) {
46-
ext[plugin] = argv[plugin] || {}
48+
config[plugin] = argv[plugin] || {}
4749
})
4850
}
4951

52+
if (argv.config) {
53+
config = Object.assign(require(path.resolve(argv.config)), config)
54+
}
55+
5056
// processing
51-
posthtml(require('post-load-plugins')(argv.config, ext))
57+
posthtml(require('post-load-plugins')(config))
5258
.process(html)
5359
.then(function (result) {
5460
fs.writeFileSync(output, result.html)

0 commit comments

Comments
 (0)