Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #4 from FGasper/master

Add a CLI interface
  • Loading branch information...
commit 749bec33fa91de5e37bf8d386d57ae862004a492 2 parents 4e36377 + b619aa5
Johan BLEUZEN authored
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"
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.