File tree 4 files changed +23
-26
lines changed
4 files changed +23
-26
lines changed Original file line number Diff line number Diff line change @@ -15,30 +15,37 @@ npm install --global posthtml-cli
15
15
``` console
16
16
$ posthtml --help
17
17
18
- Usage
18
+ Usage
19
19
posthtml --output|-o output.html --input|-i input.html [--config|-c path/to/json/config]
20
20
21
- Options
21
+ Options
22
22
--config, -c Path to JSON file [string]
23
23
--output, -o Output html file result [required]
24
24
--input, -i Input html file [required]
25
25
--help, -h Show help [boolean]
26
26
--version, -v Show version number [boolean]
27
-
28
- Example
27
+
28
+ Example
29
29
posthtml -o output.html -i input.html
30
30
```
31
31
32
- * Default read config in package.json*
32
+ For reading config used [ posthtml-load-plugins] ( https://github.com/michael-ciniawsky/posthtml-load-plugins )
33
+ * Default read options for plugins from package.json*
33
34
``` json
34
35
{
35
- "name" : " my project" ,
36
- "posthtml" : {
37
- "require" : [" posthtml-custom-elements" ]
38
- },
39
- "posthtml-custom-elements" : {
40
- "defaultTag" : " span"
41
- }
36
+ "name" : " my project" ,
37
+ "devDependencies" : {
38
+ "posthtml-custom-elements" : " ^1.0.3" ,
39
+ "posthtml-style-to-file" : " ^0.1.1"
40
+ },
41
+ "posthtml" : {
42
+ "customElements" : {
43
+ "defaultTag" : " span"
44
+ },
45
+ "styleToFile" : {
46
+ "path" : " ./dist/style.css"
47
+ }
48
+ }
42
49
}
43
50
```
44
51
Original file line number Diff line number Diff line change @@ -22,16 +22,8 @@ var argv = require('yargs')
22
22
// get htmls
23
23
var html = fs . readFileSync ( argv . input , 'utf8' ) ;
24
24
25
- // get plugins
26
- var plugins = [ ] ;
27
- if ( argv . require ) {
28
- plugins = argv . require . map ( function ( name ) {
29
- return require ( name ) ( argv [ name ] ) ;
30
- } ) ;
31
- }
32
-
33
25
// processing
34
- posthtml ( plugins )
26
+ posthtml ( require ( 'posthtml-load- plugins' ) ( argv . config ) )
35
27
. process ( html )
36
28
. then ( function ( result ) {
37
29
fs . writeFileSync ( argv . output , result . html ) ;
Original file line number Diff line number Diff line change 26
26
"homepage" : " https://github.com/GitScrum/posthtml-cli#readme" ,
27
27
"dependencies" : {
28
28
"posthtml" : " ^0.8.3" ,
29
+ "posthtml-load-plugins" : " ^0.9.1" ,
29
30
"yargs" : " ^4.3.1"
30
31
},
31
32
"devDependencies" : {
40
41
"xo" : " ^0.13.0"
41
42
},
42
43
"posthtml" : {
43
- "require" : [
44
- " posthtml-custom-elements"
45
- ]
44
+ "posthtmlCustomElements" : {}
46
45
}
47
46
}
Original file line number Diff line number Diff line change 1
1
{
2
- "require" : [" posthtml-custom-elements" ],
3
- "posthtml-custom-elements" : {
2
+ "customElements" : {
4
3
"defaultTag" : " span"
5
4
}
6
5
}
You can’t perform that action at this time.
0 commit comments