UNPKG

njsmin

Version:

A node.js module for javascript minification

40 lines (39 loc) 3.19 kB
{ "name": "njsmin", "version": "1.0.3", "main": "njsmin", "dependencies": { "iconv-lite": ">=0.1.0" }, "description": "A node.js module for javascript minification", "keywords": [ "jsmin", "javascript min", "javascript minification", "javascript minimization", "js minification", "unicode", "js minimization" ], "author": { "name": "chesihui", "email": "lover_116@163.com" }, "license": "Doug Crockford's license that allows this module to be used for Good but not for Evil", "repository": { "type": "git", "url": "https://github.com/chesihui/node-jsmin.git" }, "engines": { "node": ">=0.1.93" }, "bin": { "njsmin": "./bin/njsmin" }, "readme": "This is a node.js module for minimizing javascript (jsmin for short).\r\n\r\nIt was originally written by Doug Crockford (www.crockford.com), was ported\r\nto javascript by Franck Marcia (www.fmarcia.info), which in turn was ported\r\nto node.js by Peteris Krumins (www.catonmat.net).\r\n\r\n------------------------------------------------------------------------------\r\n\r\nThe module exports 'jsmin' function:\r\n\r\n var jsmin = require('jsmin').jsmin;\r\n\r\nThe 'jsmin' function takes three arguments:\r\n\r\n * input js code\r\n * integer aggressiveness level (defaults to 2)\r\n * optional comment to prepend to output (defaults to nothing)\r\n\r\nThe aggressiveness level can be 1, 2 or 3:\r\n\r\n * 1 - keep original newlines in output\r\n * 2 - original Crockford's algorithm - remove some newlines\r\n * 3 - remove all newlines\r\n\r\nStart the comments that you don't want to remove (as process of minification)\r\nwith /*! ... */\r\n\r\n\r\nExample\r\n-------\r\n\r\n var jsmin = require('./jsmin').jsmin;\r\n var sys = require('sys');\r\n\r\n sys.puts(jsmin('function hello( a , b , c ) { sys.log(a + b + c) }'))\r\n\r\nOutput:\r\n\r\n 'function hello(a,b,c){sys.log(a+b+c)}'\r\n\r\n\r\nCommand-line Usage\r\n------------------\r\n\r\nInstalling globally (using npm's -g flag) will also install a command-line\r\ntool for using jsmin:\r\n\r\n jsmin [OPTIONS...] [FILENAME]\r\n\r\nThe input filename should be the last argument. If you don't specify it,\r\ninput will be read from STDIN instead.\r\n\r\nSupported options:\r\n\r\n -o FILENAME\r\n --output FILENAME\r\n\r\n Specifies an output file for minified output. If not given, output\r\n will be written to STDOUT.\r\n\r\n -l LEVEL\r\n --level LEVEL\r\n\r\n Sets the aggressiveness level to be used.\r\n\r\n -c COMMENT\r\n --comment COMMENT\r\n\r\n Sets a comment to be prepended to the output.\r\n\r\n --overwrite\r\n\r\n If provided and an input filename was provided (rather than using\r\n STDIN), output will be written to the same file input was read from.\r\n\r\n------------------------------------------------------------------------------\r\n\r\nHave fun jsminning!\r\n\r\n\r\nSincerely,\r\nPeteris Krumins\r\nhttp://www.catonmat.net\r\n\r\n", "_id": "jsmin@1.0.1", "dist": { "shasum": "a9b6191149c794cb698d2b76bd9602b0cf3949af" }, "_from": "./node-jsmin/" }