Permalink
Browse files

Merge pull request #20 from kenhkan/process_conditionally

Process conditionally
  • Loading branch information...
2 parents f8ed5a4 + 64e9750 commit 6f657a395e562a8b1bd8cfe6deebefe2d5893dab @GulinSS committed Nov 19, 2013
Showing with 11 additions and 5 deletions.
  1. +8 −5 lib/index.js
  2. +3 −0 src/index.coffee
View
13 lib/index.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 1.3.3
+// Generated by CoffeeScript 1.6.3
(function() {
var JadeAngularJsCompiler, fileWriter, fs, jade, mkdirp, sysPath, _;
@@ -18,7 +18,7 @@
if (err != null) {
throw err;
}
- if (!(content != null)) {
+ if (content == null) {
return;
}
dirname = sysPath.dirname(newFilePath);
@@ -36,7 +36,6 @@
};
module.exports = JadeAngularJsCompiler = (function() {
-
JadeAngularJsCompiler.prototype.brunchPlugin = true;
JadeAngularJsCompiler.prototype.type = 'template';
@@ -56,7 +55,7 @@
}
JadeAngularJsCompiler.prototype.compile = function(data, path, callback) {
- var content, error;
+ var content, err, error;
try {
content = jade.compile(data, {
compileDebug: false,
@@ -66,7 +65,8 @@
pretty: this.pretty
});
return content(this.locals);
- } catch (err) {
+ } catch (_error) {
+ err = _error;
return error = err;
} finally {
callback(error, "");
@@ -224,6 +224,9 @@
var assets, assetsTree, preResult,
_this = this;
preResult = this.prepareResult(compiled);
+ if (preResult.length === 0) {
+ return;
+ }
assets = _.filter(preResult, function(v) {
return _this.staticMask.test(v.path);
});
View
3 src/index.coffee
@@ -148,6 +148,9 @@ module.exports = class JadeAngularJsCompiler
onCompile: (compiled) ->
preResult = @prepareResult compiled
+ # Need to stop processing if there's nothing to process
+ return if preResult.length is 0
+
assets = _.filter preResult, (v) => @staticMask.test v.path
assetsTree = @parsePairsIntoAssetsTree assets

0 comments on commit 6f657a3

Please sign in to comment.