the-minifier
v1.2.2
Published
A light library to minify css easily
Downloads
7
Readme
The Minifier
The minifier is the new fast, light and easy-to-use minifier to optimize your css files (HTML and Javascript WIP) before deploying your web applications in production
Install
npm install the-minifier
Verify package installation
the-minifier --version
If your command prompt prints the following line the package is correctly installed
the-minifier 1.2.0
Usage with cli
to see the available order list
the-minifier
you can get all the commands available via the minifier
🗜️ Minify html, css and javascript
A light library to minify javascript, css and html easily
⚙️ Options ⚙️
-h, --help 🆘 Print this usage guide
-a, --all 📝 Minify all project
-c, --css 🖌️ Minify all project css
-w, --html 🌐 Minify all project html
-j, --js 🚂 Minify all project javascript
-t, --ts 🚆 Minify all project typescript
-n, --no-min ❌ Does not generate a .min file but overwrites existing files
-v, --version 🔍 View current install version
Other languages such as html and javascript will be available in future iterations
How it works ?
to minfy css you can use the following command
the-minifier --css
imagine your css file is in a style folder like this: ./style/index.css
after using the command mentioned above you will see in this style folder a new file in this format: ./style/index.min.css
the system is the same with html or javascript
if you want to minify the html of your project type the following command
the-minifier --html
you will see *.min.html
files appear
same for javascript
the-minifier --js
you will see *.min.js
files appear
the application now supports typescript
in addition to javascript
the-minifier --ts
If you don't want to create a .min
file you can use the --no-min
option in your command.
the-minifier --js --no-min
⚠️ Warning this option will overwrite the existing file to recreate it with the minifier content
Usage library
You can use our minification methods manually by importing them directly into your project.
// example
const { cssMinifier, cssFormatter } = require('the-minifier');
Minifiy all files provided as arguments
cssMinifier(cssFilesPath, nomin);
| arguments | description | type |
|-:|--|:-|
|cssFilesPath|Array containing the path of the files to minify|Array|
|nomin|If this argument is true it will generate a .min
file|Boolean|
Minifiy all files provided as arguments
htmlMinifier(htmlFilesPath, nomin);
| arguments | description | type |
|-:|--|:-|
|htmlFilesPath|Array containing the path of the files to minify|Array|
|nomin|If this argument is true it will generate a .min
file|Boolean|
Minifiy all files provided as arguments
jsMinifier(jsFilesPath, nomin);
| arguments | description | type |
|-:|--|:-|
|jsFilesPath|Array containing the path of the files to minify|Array|
|nomin|If this argument is true it will generate a .min
file|Boolean|
Minifiy all files provided as arguments
tsMinifier(tsFilesPath, nomin);
| arguments | description | type |
|-:|--|:-|
|tsFilesPath|Array containing the path of the files to minify|Array|
|nomin|If this argument is true it will generate a .min
file|Boolean|
Return string content minify
htmlFormatter(htmlContent);
| arguments | description | type | |-:|--|:-| |htmlContent|Content to minify|string|
Return string content minify
cssFormatter(cssContent);
| arguments | description | type | |-:|--|:-| |cssContent|Content to minify|string|
Return string content minify
⚠️ The jsFormatter method also supports typescript
jsFormatter(jsContent);
| arguments | description | type | |-:|--|:-| |jsContent|Content to minify|string|
Bugs
If you find a bug please report it on github by creating a new issues.
Contributing
If you wish to contribute to the project refer to CONTRIBUTING.md