Skip to content

Commit

Permalink
Add Sqwish CSS compressor
Browse files Browse the repository at this point in the history
  • Loading branch information
srod committed Dec 16, 2012
1 parent 8c13738 commit 4fb9d1a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
19 changes: 19 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

- UglifyJS2

- Sqwish

It allow you to compress JavaScript and CSS files.

I recommend to execute it at boot time for production use.
Expand Down Expand Up @@ -99,6 +101,17 @@ new compressor.minify({
console.log(err);
}
});

// Using Sqwish for CSS
new compressor.minify({
type: 'sqwish',
fileIn: ['public/css/base.css', 'public/css/base2.css'],
fileOut: 'public/css/base-min-sqwish.css',
callback: function(err){
console.log('Sqwish');
console.log(err);
}
});
```

## Concatenate Files
Expand Down Expand Up @@ -172,6 +185,12 @@ new compressor.minify({

https://github.com/mishoo/UglifyJS2

## Sqwish

Sqwish can compress only CSS files.

https://github.com/ded/sqwish

## Warning

It assumes you have Java installed on your environment for both GCC and YUI Compressor. To check, run:
Expand Down
11 changes: 11 additions & 0 deletions examples/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,15 @@ new compressor.minify({
}
});

// Using Sqwish
new compressor.minify({
type: 'sqwish',
fileIn: ['public/css/base.css', 'public/css/base2.css'],
fileOut: 'public/css/base-min-sqwish.css',
callback: function(err){
console.log('Sqwish');
console.log(err);
}
});

console.log('Server running at http://127.0.0.1:1337/');
3 changes: 3 additions & 0 deletions lib/node-minify.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ var minify = (function (undefined) {
case 'uglifyjs2':
command = prefix + '"' + __dirname + '/../node_modules/uglify-js2/bin/uglifyjs2" --output "' + this.fileOut + '" ' + (this.copyright ? '' : '--no-copyright') + ' "' + this.fileIn + '" ' + this.options.join(' ');
break;
case 'sqwish':
command = prefix + '"' + __dirname + '/../node_modules/sqwish/bin/sqwish" "' + this.fileIn + '" -o "' + this.fileOut + '" ' + this.options.join(' ');
break;
// Useful when wanting only to concatenate the files and not to compress them
case 'no-compress':
var os = _fs.createWriteStream(this.fileOut);
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "node-minify",
"version": "0.6.1",
"description": "Javascript / CSS minifier based on YUI Compressor / Google Closure Compiler / UglifyJS / UglifyJS2",
"description": "Javascript / CSS minifier based on YUI Compressor / Google Closure Compiler / UglifyJS / UglifyJS2 / Sqwish",
"homepage": "https://github.com/srod/node-minify",
"author": {
"name": "Rodolphe Stoclin",
Expand All @@ -18,8 +18,9 @@

"dependencies": {
"uglify-js": "*",
"uglify-js2": "*"
"uglify-js2": "*",
"sqwish": "*"
},

"keywords": ["compressor", "minify", "minifier", "yui", "gcc", "google", "closure", "compiler", "uglifyjs", "uglifyjs2", "windows"]
"keywords": ["compressor", "minify", "minifier", "yui", "gcc", "google", "closure", "compiler", "uglifyjs", "uglifyjs2", "windows", "sqwish"]
}

0 comments on commit 4fb9d1a

Please sign in to comment.