Permalink
Browse files

Use crsh prefix to make output files gitignore-able

  • Loading branch information...
1 parent cb937ac commit dbc430fc1943086658aa5909930dcc0448ae016b @Qard committed Jan 26, 2012
Showing with 9 additions and 7 deletions.
  1. +9 −7 lib/index.js
View
16 lib/index.js
@@ -15,7 +15,7 @@ var helper = require('./helper')
*/
function Crsh (path, list) {
var self = this
- this.name = helper.md5(list.join(',')) + '.js'
+ this.name = 'crsh-' + helper.md5(list.join(',')) + '.js'
// Path is optional
if (typeof path !== 'string') {
@@ -117,7 +117,7 @@ Crsh.prototype.compile = function (cb) {
if (err) cb(err)
// Merge all the files
- var merged = list.map(function (file) {
+ var data = list.map(function (file) {
// Compile coffeescript files
if (path.extname(file) === '.coffee') {
@@ -128,11 +128,13 @@ Crsh.prototype.compile = function (cb) {
return files[file]
}).join('')
- // Uglify the merged data
- var ast = jsp.parse(merged)
- ast = pro.ast_mangle(ast)
- ast = pro.ast_squeeze(ast)
- var data = pro.gen_code(ast)
+ // Only uglify in production
+ if (process.env.NODE_ENV === 'production') {
+ var ast = jsp.parse(data)
+ ast = pro.ast_mangle(ast)
+ ast = pro.ast_squeeze(ast)
+ data = pro.gen_code(ast)
+ }
// Write merged and uglified data to file
var p = path.join(self.path, self.name)

0 comments on commit dbc430f

Please sign in to comment.