1.2.2 ā€¢ Published 2 years ago

the-minifier v1.2.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

The Minifier

Maintainability Test Coverage example workflow

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);
argumentsdescriptiontype
cssFilesPathArray containing the path of the files to minifyArray
nominIf this argument is true it will generate a .min fileBoolean

Minifiy all files provided as arguments

htmlMinifier(htmlFilesPath, nomin);
argumentsdescriptiontype
htmlFilesPathArray containing the path of the files to minifyArray
nominIf this argument is true it will generate a .min fileBoolean

Minifiy all files provided as arguments

jsMinifier(jsFilesPath, nomin);
argumentsdescriptiontype
jsFilesPathArray containing the path of the files to minifyArray
nominIf this argument is true it will generate a .min fileBoolean

Minifiy all files provided as arguments

tsMinifier(tsFilesPath, nomin);
argumentsdescriptiontype
tsFilesPathArray containing the path of the files to minifyArray
nominIf this argument is true it will generate a .min fileBoolean

Return string content minify

htmlFormatter(htmlContent);
argumentsdescriptiontype
htmlContentContent to minifystring

Return string content minify

cssFormatter(cssContent);
argumentsdescriptiontype
cssContentContent to minifystring

Return string content minify

āš ļø The jsFormatter method also supports typescript

jsFormatter(jsContent);
argumentsdescriptiontype
jsContentContent to minifystring

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

1.2.0

2 years ago

1.1.0

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago