Permalink
Browse files

use less (ycssmin by proxy) for css compilation

  • Loading branch information...
1 parent 0ea326b commit ff0fa69275be55bad2614888b478c24511962300 @jairajs89 committed Apr 3, 2013
Showing with 21 additions and 20 deletions.
  1. +1 −2 package.json
  2. +20 −18 zerver.js
View
@@ -2,7 +2,7 @@
"author": "Jairaj Sethi <j@jairaj.org> (http://jairaj.org/)",
"name": "zerver",
"description": "client-integrated webapp server",
- "version": "0.9.1",
+ "version": "0.9.2",
"repository": {
"type": "git",
"url": "git://github.com/jairajs89/zerver.git"
@@ -14,7 +14,6 @@
"dependencies": {
"mime" : "1.2.7" ,
"uglify-js" : "1.3.4" ,
- "clean-css" : "0.8.3" ,
"less" : "1.3.3" ,
"stalker" : "0.0.20" ,
"findit" : "0.1.2" ,
View
@@ -1,14 +1,13 @@
/* Imports and static vars */
-var cleanCSS = require('clean-css'),
- less = require('less'),
- fs = require('fs' ),
- http = require('http'),
- mime = require('mime'),
- path = require('path'),
- uglify = require('uglify-js'),
- url = require('url' ),
- zlib = require('zlib');
+var less = require('less'),
+ fs = require('fs' ),
+ http = require('http'),
+ mime = require('mime'),
+ path = require('path'),
+ uglify = require('uglify-js'),
+ url = require('url' ),
+ zlib = require('zlib');
var ROOT_DIR = process.cwd(),
GZIPPABLE = {
@@ -602,8 +601,6 @@ function compileOutput (type, data, callback) {
return;
}
- var code;
-
switch (type) {
case 'application/javascript':
case 'text/javascript':
@@ -612,20 +609,25 @@ function compileOutput (type, data, callback) {
var ast = uglify.parser.parse(data);
ast = uglify.uglify.ast_mangle(ast);
ast = uglify.uglify.ast_squeeze(ast);
- code = uglify.uglify.gen_code(ast);
+ data = uglify.uglify.gen_code(ast);
}
catch (err) {}
+ callback(type, data);
break;
case 'text/css':
- try {
- code = cleanCSS.process(data);
- }
- catch (err) {}
+ less.render(data, { compress : true }, function (err, compiledCSS) {
+ if ( !err ) {
+ data = compiledCSS;
+ }
+ callback(type, data);
+ });
break;
- }
- callback(type, code || data);
+ default:
+ callback(type, data);
+ break;
+ }
});
}

0 comments on commit ff0fa69

Please sign in to comment.