Skip to content

Commit

Permalink
Add CLI interface, fill out package.json, bump version number
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipe Gasper authored and Felipe Gasper committed Nov 4, 2011
1 parent 4e36377 commit b619aa5
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1 +1,2 @@
node-cssmin.esproj node-cssmin.esproj
.*
26 changes: 26 additions & 0 deletions 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 });
}
13 changes: 10 additions & 3 deletions package.json
@@ -1,10 +1,17 @@
{ {
"name": "cssmin", "name": "cssmin",
"version": "0.3.0", "version": "0.3.1",
"description": "A simple CSS File minifier that uses a port of YUICompressor in JS", "description": "A simple CSS minifier that uses a port of YUICompressor in JS",
"main": "cssmin", "main": "cssmin",
"bin": {
"cssmin": "./bin/cssmin"
},
"author" : { "author" : {
"name" : "Johan Bleuzen", "name" : "Johan Bleuzen",
"url" : "http://blog.johanbleuzen.fr" "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.