cdt minify [FILE]
Minify functionality, Allows user to minify supported file.
USAGE$ cdt minify [FILE]OPTIONS-f, --file=file file to be minified-h, --help show CLI help-o, --outputFile=outputFile output file path-t, --type=type type of file to be minified, it will try to find typewith extension supported: JS, HTML/HTM, CSS
Minifying a file
( supported type: JS, HTML/HTM, CSS )
$ cdt minify test.jsℹ info reading file: test.jsℹ info file type: JS✔ file: undefined minified✔ success minified output:console.log("lorem ipsum");let x=10;x<10?console.log("x is less than: "+x):x>10?console.log("x is more than: "+x):console.log("x is equals to: "+x);
- we can also use -f flag to pass file path
$ cdt minify -f test.jsℹ info reading file: test.jsℹ info file type: JS✔ file: undefined minified✔ success minified output:console.log("lorem ipsum");let x=10;x<10?console.log("x is less than: "+x):x>10?console.log("x is more than: "+x):console.log("x is equals to: "+x);Note: -f flag will override the string file path passed with argument
Specifying file type
We can use -t or --type flag for passing type e.g. JS
$ cdt minify -t js test.jsℹ info reading file: test.jsℹ info file type: JS✔ file: undefined minified✔ success minified output:console.log("lorem ipsum");let x=10;x<10?console.log("x is less than: "+x):x>10?console.log("x is more than: "+x):console.log("x is equals to: "+x);Note: If a invalid type is given ex. if HTML is given and file is JS, then we'll get an error.
Writing output to a file
We can use -o or --output flag to pass output file path
cdt minify -f test.css -o output.cssℹ info reading file: test.cssℹ info file type: CSS✔ file: test/resources/test.css minifiedℹ info Could not find file: output.css, creating new one✔ success output written to file: output.css