@@ -13,11 +13,13 @@ const cli = meow(`
1313 Usage: posthtml <patterns>
1414
1515 Options:
16- --output -o Output File or Folder
17- --config -c Path to config file
18- --use -u PostHTML plugin name
19- --help -h CLI Help
20- --version -v CLI Version
16+ --output -o Output File or Folder
17+ --config -c Path to config file
18+ --use -u PostHTML plugin name
19+ --root -r Mirror the directory structure relative to this path in the output directory(default: .)
20+ --allInOutput -a Save the nesting structure for output
21+ --help -h CLI Help
22+ --version -v CLI Version
2123
2224 Examples:
2325 $ posthtml input.html
@@ -26,7 +28,8 @@ const cli = meow(`
2628 $ posthtml input.html -o output.html -c posthtml.js
2729 $ posthtml input.html -o output.html -u posthtml-bem --posthtml-bem.elemPrefix __
2830 $ posthtml inputFolder/*.html -o outputFolder
29- $ posthtml inputFolder/**/*.html -o outputFolder
31+ $ posthtml inputFolder/**/*.html -o outputFolder -a
32+ $ posthtml inputFolder/**/*.html -o outputFolder -a -r inputFolder
3033` , {
3134 flags : {
3235 config : {
@@ -48,6 +51,15 @@ const cli = meow(`
4851 use : {
4952 type : 'array' ,
5053 alias : 'u'
54+ } ,
55+ root : {
56+ type : 'string' ,
57+ alias : 'r' ,
58+ default : '.'
59+ } ,
60+ allInOutput : {
61+ type : 'boolean' ,
62+ alias : 'a'
5163 }
5264 }
5365} ) ;
@@ -68,7 +80,7 @@ const getPlugins = config => Object.keys(config.plugins || {})
6880const config = cfgResolve ( cli ) ;
6981
7082const processing = async file => {
71- const output = await outResolve ( file , config . output ) ;
83+ const output = await outResolve ( file , config ) ;
7284 const plugins = Array . isArray ( config . plugins ) ? config . plugins : getPlugins ( config ) ;
7385
7486 makeDir ( path . dirname ( output ) )
0 commit comments