diff --git a/lib/javascript/index.js b/lib/javascript/index.js index 6e4184618..88989508c 100644 --- a/lib/javascript/index.js +++ b/lib/javascript/index.js @@ -1,7 +1,7 @@ - var path = require("path") var fs = require("fs") var helpers = require('../helpers') +var minify = require('minify') /** * Build Processor list for javascripts. @@ -41,8 +41,16 @@ module.exports = function(root, filePath, callback){ * Lookup Directories */ - var render = processors[ext].compile(srcPath, data, callback) + var render = processors[ext].compile(srcPath, data, function(err, js) { + if (err) return callback(err); + + /** + * Consistently minify + */ + var post = minify.js(js); + callback(null, post); + }) }) -} \ No newline at end of file +} diff --git a/test/fixtures/javascripts/coffee/main.coffee b/test/fixtures/javascripts/coffee/main.coffee index ca29a94ea..0f2c927a2 100644 --- a/test/fixtures/javascripts/coffee/main.coffee +++ b/test/fixtures/javascripts/coffee/main.coffee @@ -1,2 +1,5 @@ + + + add = (x, y) -> - return x + y \ No newline at end of file + return x + y diff --git a/test/javascripts.js b/test/javascripts.js index 7605f846b..e8619370d 100644 --- a/test/javascripts.js +++ b/test/javascripts.js @@ -11,6 +11,8 @@ describe("javascripts", function(){ poly.render("main.coffee", function(errors, body){ should.not.exist(errors) should.exist(body) + console.log(body); + body.should.not.include("\n\n") done() }) })