diff --git a/README.md b/README.md index c2cb7a1..88c6f25 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ ## Description -This is a node.js module that minimize CSS files (cssmin). +**It's a fork of [jbleuzen/node-cssmin](https://github.com/jbleuzen/node-cssmin) with ability to generate result in file from cli.** + +This is a nodejs module that minimize CSS files (cssmin). It uses a port of YUICompressor made in JavaScript by Stoyan Stefanov based on Isaac Schlueter work. [For more informations about YUICompressor](https://github.com/yui/yuicompressor) diff --git a/bin/cssmin b/bin/cssmin index ae4bcc6..4b0da41 100755 --- a/bin/cssmin +++ b/bin/cssmin @@ -11,18 +11,21 @@ function squeeze_out(css_in) { } if (arg.length) { - arg = arg[0].replace(/^(-)+/,''); - switch(arg) { + var from = arg[0].replace(/^(-)+/,''); + switch(from) { case 'h' : showHelp(); break; case 'help' : showHelp(); break; default : - fs.readFile( arg, "utf8", function(err, css_in) { - if (err) { - util.puts("Invalid file : "+ arg); - process.exit(1); - } + fs.readFile( from, "utf8", function(err, css_in) { + if (err) { + util.puts("Invalid file : "+ from); + process.exit(1); + } + else if (arg.length > 1){ + fs.writeFileSync(arg[1], cssmin(css_in)); + } else { squeeze_out(css_in); } diff --git a/package.json b/package.json index e2d218b..867d005 100755 --- a/package.json +++ b/package.json @@ -1,18 +1,24 @@ { - "name": "cssmin", - "version": "0.4.3", - "description": "A simple CSS minifier that uses a port of YUICompressor in JS", - "main": "cssmin", - "bin": { - "cssmin": "./bin/cssmin" - }, - "author": { - "name": "Johan Bleuzen", - "url": "http://blog.johanbleuzen.fr" - }, - "license": "BSD-2-Clause", - "repository": { - "type": "git", - "url": "http://github.com/jbleuzen/node-cssmin" - } + "name": "cssmin-cli", + "version": "0.0.5", + "description": "A simplest CSS minifier that uses a port of YUICompressor in JS", + "main": "cssmin", + "bin": { + "cssmin": "./bin/cssmin" + }, + "author": "Johan Bleuzen (http://blog.johanbleuzen.fr)", + "license": "BSD-2-Clause", + "repository": { + "type": "git", + "url": "https://git@github.com/mixartemev/node-cssmin" + }, + "bugs": { + "url": "https://github.com/mixartemev/node-cssmin/issues" + }, + "homepage": "https://github.com/mixartemev/node-cssmin#readme", + "dependencies": {}, + "devDependencies": {}, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + } }