Comparing version 1.0.1 to 1.1.0
@@ -6,3 +6,3 @@ #!/usr/bin/env node | ||
var inputDir = input[2]; | ||
var inputMinType = input[3]; | ||
var inputMinType = input[3] || "uglifyjs"; | ||
var compressor = require("node-minify"); | ||
@@ -24,2 +24,3 @@ | ||
options = options || {}; | ||
options.type = options.type || inputMinType; | ||
@@ -32,3 +33,3 @@ walk(dir, function(path, result){ | ||
new compressor.minify({ | ||
type: "uglifyjs", | ||
type: options.type, | ||
fileIn: path, | ||
@@ -35,0 +36,0 @@ fileOut: path, |
{ | ||
"name": "minify-all", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "A tool that minifies all .js files in a folder and its nested folders", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# Minify-All | ||
A function that minifies your javascript files, and all the javascript files in your nested folders as well. **Minify-All** can be used as a CLI or can be run in your code. By giving it a directory, Minify-All will walk through the depth of your folders and minify all the javascript that it sees. | ||
### Installation | ||
@@ -9,2 +11,29 @@ | ||
> minify-all [folder] | ||
> minify-all [folder] [compression type] | ||
### Run in your code | ||
`minifyAll` function has 3 parts: directory, options, and callback, such that | ||
minifyAll([directory], [options], [callback]) | ||
The callback outputs 2 options: | ||
* **error**: the error of each file | ||
* **minified**: the output of the minified file | ||
##### Example | ||
var minifyAll = require("minify-all"); | ||
minifyAll("./", { silent: true }, function(err){ | ||
if(err){ | ||
console.log(err); | ||
} | ||
}); | ||
### Options | ||
**silent** | ||
If silent mode is on, then logs of which files has been found won't be displayed | ||
**type** | ||
Determines the compression type the file should be put through. As **Minify-All** depends on **node-minify**, these types are defined by **node-minify** and can be found [here](https://www.npmjs.com/package/node-minify). If a type is not specified, then by default it is *uglifyjs* |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3233
43
39