Skip to content
Browse files

Add CLI interface, fill out package.json, bump version number

  • Loading branch information...
1 parent 4e36377 commit b619aa578347a31991a2b500e5f03120b94b7fd3 Felipe Gasper committed Nov 4, 2011
Showing with 38 additions and 4 deletions.
  1. +2 −1 .gitignore
  2. +26 −0 bin/cssmin
  3. +10 −3 package.json
View
3 .gitignore
@@ -1 +1,2 @@
-node-cssmin.esproj
+node-cssmin.esproj
+.*
View
26 bin/cssmin
@@ -0,0 +1,26 @@
+#!/usr/bin/env node
+// -*- js -*-
+
+var args = process.argv.slice(2);
+
+function squeeze_out(css_in) {
+ process.stdout.write( require("cssmin").cssmin(css_in) );
+}
+
+if (args.length) {
+ require("fs").readFile( args[0], "utf8", function(err, css_in) {
+ if (err) {
+ throw err;
+ }
+ else {
+ squeeze_out(css_in);
+ }
+ } );
+}
+else {
+ var stdin = process.openStdin();
+ stdin.setEncoding("utf8");
+ var css_in = "";
+ stdin.on("end", function() { squeeze_out(css_in) });
+ stdin.on("data", function(chunk) { css_in += chunk });
+}
View
13 package.json
@@ -1,10 +1,17 @@
{
"name": "cssmin",
- "version": "0.3.0",
- "description": "A simple CSS File minifier that uses a port of YUICompressor in JS",
+ "version": "0.3.1",
+ "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"
- }
+ },
+ "repository" : {
+ "type" : "git",
+ "url" : "http://github.com/jbleuzen/node-cssmin"
+ }
}

0 comments on commit b619aa5

Please sign in to comment.
Something went wrong with that request. Please try again.