Skip to content
This repository has been archived by the owner on Jun 9, 2020. It is now read-only.

Commit

Permalink
Merge pull request #4 from FGasper/master
Browse files Browse the repository at this point in the history
Add a CLI interface
  • Loading branch information
Johan BLEUZEN committed Nov 9, 2011
2 parents 4e36377 + b619aa5 commit 749bec3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node-cssmin.esproj
node-cssmin.esproj
.*
26 changes: 26 additions & 0 deletions bin/cssmin
Original file line number Diff line number Diff line change
@@ -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 });
}
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -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 749bec3

Please sign in to comment.