Skip to content

jcs090218/node-minify-dir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status npm version License: MIT

NPM

minify-dir

Minify all the files under a directory.

Install

$ npm install -g minify-dir

Usage

usage : minify-dir I_FOLDER [output O_FOLDER]

Minify-Dir : Minify all the files under a directory.

positional arguments:
  I_FOLDER          Directory you want to minified.

optional arguments:
  O_FOLDER          Output all the minified files here.

CLI

Try minify a directory.

# Default Output => `website.min`
$ minify-dir ./website

# Target Output => `website2`
$ minify-dir ./website ./website2

Or you can minify file instead of a directory.

# Default Output => `website.min/anyfile.html`
$ minify-dir ./website/anyfile.html

# Target Output => `website2/anyfile.html`
$ minify-dir ./website/anyfile.html ./website2/anyfile.html

Example Code

Include minify-dir package in your code.

const minifyDir = require('minify-dir');

Minify all files under website directory recursively, defualt will output to website.min directory.

minifyDir.minifyDirectory([source], [option destination]);

/* Default Output => `website.min` */
minifyDir.minifyDirectory("./website");

/* Target Output => `website2` */
minifyDir.minifyDirectory("./website", "./website2");

Minify a CSS/HTML/JS file, default will output to website.min/anyfile.html.

minifyDir.minifyFile([source], [option destination]);

/* Default Output => `website.min/anyfile.html` */
minifyDir.minifyFile("./website/anyfile.html");

/* Target Output => `website2/anyfile.html` */
minifyDir.minifyFile("./website/anyfile.html", "./website2/anyfile.html");

Service Provider