|
1 | 1 | --- |
2 | | -id: hash |
3 | | -title: Hash |
4 | | -sidebar_label: Hash Command |
| 2 | +id: minify |
| 3 | +title: Minify |
| 4 | +sidebar_label: Minify |
5 | 5 | --- |
6 | | -### `cdt hash [STRING]` |
| 6 | +### `cdt minify [FILE]` |
7 | 7 |
|
8 | | -Hashing functionality for a string/file |
| 8 | +Minify functionality for a string/file |
9 | 9 |
|
10 | 10 | ``` bash |
11 | 11 | USAGE |
12 | | - $ cdt hash [STRING] |
| 12 | + $ cdt minify [FILE] |
13 | 13 |
|
14 | 14 | OPTIONS |
15 | | - -f, --file=file file to be hashed |
16 | | - -h, --help show CLI help |
17 | | - -s, --string=string string to be hashed |
18 | | - -t, --type=type type of hash [SHA1(default), MD5, SHA256, SHA512, RMD160 or RIPEMD160] |
| 15 | + -f, --file=file file to be minified |
| 16 | + -h, --help show CLI help |
| 17 | + -o, --outputFile=outputFile output file path |
| 18 | + |
| 19 | + -t, --type=type type of file to be minified, it will try to find type |
| 20 | + with extension supported: JS, HTML/HTM, CSS |
| 21 | + |
19 | 22 | ``` |
20 | | -### Finding hash of a given string for default type ( SHA1 ) |
| 23 | +### Minifying a file |
21 | 24 | ------ |
| 25 | +> ( supported type: JS, HTML/HTM, CSS ) |
22 | 26 | ``` bash |
23 | | -$ cdt hash 'abcde' |
24 | | -✔ success [SHA1] 03de6c570bfe24bfc328ccd7ca46b76eadaf4334 |
| 27 | +$ cdt minify test.js |
| 28 | +ℹ info reading file: test.js |
| 29 | +ℹ info file type: JS |
| 30 | +✔ file: undefined minified |
| 31 | +✔ success minified output: |
| 32 | +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); |
25 | 33 | ``` |
26 | | -* we can also use ***-s flag*** |
27 | | - |
| 34 | +* we can also use ***-f flag to pass file path*** |
28 | 35 | ``` bash |
29 | | -$ cdt hash -s 'abcde' |
30 | | -✔ success [SHA1] 03de6c570bfe24bfc328ccd7ca46b76eadaf4334 |
| 36 | +$ cdt minify -f test.js |
| 37 | +ℹ info reading file: test.js |
| 38 | +ℹ info file type: JS |
| 39 | +✔ file: undefined minified |
| 40 | +✔ success minified output: |
| 41 | +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); |
31 | 42 | ``` |
32 | | -> Note: ***-s flag*** will override the string passed with argument |
| 43 | +> Note: ***-f flag*** will override the string file path passed with argument |
33 | 44 |
|
34 | | -### Finding hash of a given string for any type e.g. MD5 |
| 45 | +### Specifying file type |
35 | 46 | ------ |
| 47 | +> We can use -t or --type flag for passing type e.g. JS |
36 | 48 | ``` bash |
37 | | -$ cdt hash -t md5 'abcde' |
38 | | -✔ success [MD5] ab56b4d92b40713acc5af89985d4b786 |
| 49 | +$ cdt minify -t js test.js |
| 50 | +ℹ info reading file: test.js |
| 51 | +ℹ info file type: JS |
| 52 | +✔ file: undefined minified |
| 53 | +✔ success minified output: |
| 54 | +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); |
39 | 55 | ``` |
40 | | - |
41 | | -> Note: Possible types SHA1(default), MD5, SHA256, SHA512, RMD160 or RIPEMD160 |
42 | | -
|
43 | | -### Finding hash of a given file for any type e.g. MD5 |
| 56 | +> Note: If a invalid type is given ex. if HTML is given and file is JS, then we'll get an error. |
| 57 | + |
| 58 | +### Writing output to a file |
44 | 59 | ------ |
| 60 | +> We can use -o or --output flag to pass output file path |
45 | 61 | ``` bash |
46 | | -$ cdt hash -t md5 -f ./file.txt |
47 | | -✔ success [MD5] ab56b4d92b40713acc5af89985d4b786 |
| 62 | +cdt minify -f test.css -o output.css |
| 63 | +ℹ info reading file: test.css |
| 64 | +ℹ info file type: CSS |
| 65 | +✔ file: test/resources/test.css minified |
| 66 | +ℹ info Could not find file: output.css, creating new one |
| 67 | +✔ success output written to file: output.css |
48 | 68 | ``` |
49 | | - |
|
0 commit comments