@@ -3,32 +3,42 @@ const program = require('commander');
33const fs = require ( 'fs' ) ;
44const { default : PurgeCSS , defaultOptions, setOptions } = require ( '../lib/purgecss' )
55
6+ function getList ( list ) {
7+ return list . split ( ',' )
8+ }
9+
610program
711 . usage ( '--css <css> --content <content> [options]' )
8- . option ( '-con, --content' , 'glob of content files' )
9- . option ( '-css, --css' , 'glob of css files' )
10- . option ( '-c, --config' , 'path to the configuration file' )
11- . option ( '-o, --output' , 'file path directory to write purged css files to' )
12- . option ( '-w, --whitelist' , 'list of classes that should not be removed' , [ ] ) ;
12+ . option ( '-con, --content <files>' , 'glob of content files (comma separated)' , getList )
13+ . option ( '-css, --css <files>' , 'glob of css files (comma separated)' , getList )
14+ . option ( '-c, --config <path>' , 'path to the configuration file' )
15+ . option ( '-o, --output <path>' , 'file path directory to write purged css files to' )
16+ . option ( '-font, --font-face' , 'option to remove unused font-faces' )
17+ . option ( '-keyframes, --keyframes' , 'option to remove unused keyframes' )
18+ . option ( '-rejected, --rejected' , 'option to output rejected selectors' )
19+ . option ( '-w, --whitelist <list>' , 'list of classes that should not be removed (comma separated)' , getList ) ;
1320
1421program . parse ( process . argv ) ;
1522
1623// config file is not specified or the content and css are not,
1724// PurgeCSS will not run
18- if ( ! program . config || ! ( program . content && program . css ) ) {
25+ if ( ! program . config && ! ( program . content && program . css ) ) {
1926 program . help ( ) ;
2027}
2128
2229( async ( ) => {
2330 // if the config file is present, use it
2431 // other options specified will override
25- let options ;
32+ let options = defaultOptions ;
2633 if ( program . config ) {
2734 options = await setOptions ( program . config ) ;
2835 }
29-
3036 if ( program . content ) options . content = program . content ;
3137 if ( program . css ) options . css = program . css ;
38+ if ( program . fontFace ) options . fontFace = program . fontFace ;
39+ if ( program . keyframes ) options . keyframes = program . keyframes ;
40+ if ( program . rejected ) options . rejected = program . rejected ;
41+ if ( program . variables ) options . variables = program . variables ;
3242 if ( program . whitelist ) options . whitelist = program . whitelist ;
3343
3444 const purged = await new PurgeCSS ( ) . purge ( options ) ;
0 commit comments