Comparing version 0.3.1 to 0.3.2
@@ -56,2 +56,3 @@ var CSSFile, File, JSFile, fs, log, path; | ||
this.module = this._getModuleName(); | ||
this.main = false; | ||
this.updateContents(contents || fs.readFileSync(this.filepath, 'utf8')); | ||
@@ -61,15 +62,18 @@ } | ||
JSFile.prototype.updateContents = function(contents) { | ||
var indent, _ref; | ||
this.contents = this.compile ? contents : "`" + contents + "`"; | ||
if (!this.RE_MODULE.test(contents)) { | ||
return this.dependencies = this._getModuleDependencies(); | ||
}; | ||
JSFile.prototype.wrap = function() { | ||
var contents, indent, _ref; | ||
contents = this.contents; | ||
if (!this.RE_MODULE.test(this.contents)) { | ||
if (this.compile) { | ||
indent = ((_ref = contents.match(this.RE_INDENT_WHITESPACE)) != null ? _ref[1] : void 0) || '\t'; | ||
this.contentsModule = "require.module '" + this.module + "', (module, exports, require) ->\n" + (contents.replace(this.RE_LINE_BEGIN, indent)); | ||
contents = "require.module '" + this.module + "', (module, exports, require) ->\n" + (contents.replace(this.RE_LINE_BEGIN, indent)) + "\n\n" + (this.main ? "require('" + this.module + "')" : ''); | ||
} else { | ||
this.contentsModule = "`require.module('" + this.module + "', function(module, exports, require) {\n" + contents + "\n});`"; | ||
contents = "`require.module('" + this.module + "', function(module, exports, require) {\n" + contents + "\n});\n\n" + (this.main ? "require('" + this.module + "');" : '') + "`"; | ||
} | ||
} else { | ||
this.contentsModule = this.contents; | ||
} | ||
return this.dependencies = this._getModuleDependencies(); | ||
return contents; | ||
}; | ||
@@ -76,0 +80,0 @@ |
@@ -104,2 +104,3 @@ var CSSTarget, JSTarget, Target, coffee, file, fs, growl, less, log, path, stylus, term, uglify; | ||
JSTarget.__super__.constructor.call(this, input, output, sourceCache); | ||
if (this.nodejs) this.batch = true; | ||
} | ||
@@ -120,2 +121,3 @@ | ||
} | ||
if (file.filepath === this.input && !this.batch) file.main = true; | ||
return JSTarget.__super__._addInput.call(this, file); | ||
@@ -130,4 +132,4 @@ }; | ||
f = _ref[_i]; | ||
filepath = path.join(this.output, f.name) + this.EXTENSION; | ||
content = this.nodejs ? f.contents : f.contentsModule; | ||
filepath = path.extname(this.output).length ? this.output : path.join(this.output, f.name) + this.EXTENSION; | ||
content = this.nodejs ? f.contents : f.wrap(); | ||
if (f.compile) { | ||
@@ -148,3 +150,3 @@ this._compile(content, filepath, false); | ||
f = _ref2[_j]; | ||
contents.push(f.contentsModule); | ||
contents.push(f.wrap()); | ||
} | ||
@@ -151,0 +153,0 @@ return this._compile(contents.join('\n\n'), this.output, true); |
{ | ||
"name": "buddy", | ||
"description": "A build framework for the compilation of higher order js/css languages (coffeescript/stylus/less).", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"author": "popeindustries <alex@pope-industries.com>", | ||
@@ -6,0 +6,0 @@ "keywords": ["javascript", "coffeescript", "styus", "less"], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
49483
660