JSPM

  • Created
  • Published
  • Downloads 42894
  • Score
    100M100P100Q132077F

Minifier of js, css, html and img

Package Exports

  • minify

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (minify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Minify Build Status

Minify - a minifier of js, css, html and img files, used in Cloud Commander project.

Install

You can install minify just like that:

npm i minify

or

git clone git://github.com/coderaiser/minify

API

Minify module contains some api for interacting from another js files.

To use Minify functions it sould be connected first. It's doing like always.

minify=require('minify');

All of minification functions save files in ./min directory with extension .min (*.min.js, *.min.css, *.min.html). If directory could be created minify.MinFolder would countain stirng 'min/', in any other case - '/'.

optimize(pFiles_a, pCache_b) - function which minificate js, html and css-files.

  • pFiles_a - varible, wich contain array of file names or string, if name single.
  • pCache_b(optional) - if true files do not writes on disk, just saves in Minify Cache.

Examples:

minify.optimize('client.js');

if a couple files:

minify.optimize(['client.js',
    'style.css']);

if post processing needed

minify.optimize({
    'client.js' : function(pFinalCode){}
});

if post image converting needed (works with css only)

minify.optimize([{'style.css':true},
    'index.html']);

if no need to write on disk

minify.optimize('client.js', {
    'client.js' : function(pFinalCode){}
},true);

Then we can work with js data just like this:

console.log(minify.Cache['client.js']);

MinFolder - varible thet contains folder name, where minimized files stored. (could not be changed for now).
Additional modules:

Install addtitional modules:

npm i uglify-js clean-css html-minifier css-b64-images