Skip to content

Commit

Permalink
Adds consistent JavaScript minifying for #30
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethormandy committed Aug 11, 2014
1 parent 17a1370 commit 9f563d6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
14 changes: 11 additions & 3 deletions lib/javascript/index.js
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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);
})

})

}
}
5 changes: 4 additions & 1 deletion test/fixtures/javascripts/coffee/main.coffee
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@



add = (x, y) ->
return x + y
return x + y
2 changes: 2 additions & 0 deletions test/javascripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
})
Expand Down

0 comments on commit 9f563d6

Please sign in to comment.