grunt-jasper
Advanced tools
Comparing version 0.1.12 to 0.1.13
{ | ||
"name": "grunt-jasper", | ||
"version": "0.1.12", | ||
"version": "0.1.13", | ||
"description": "Grunt task to build and package jasper application", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/jasperjs/grunt-jasper", |
@@ -109,3 +109,3 @@ /* | ||
if(def.attributes){ | ||
if (def.attributes) { | ||
def.attributes = utils.getJasperAttributes(def.attributes); | ||
@@ -187,13 +187,5 @@ } | ||
if (options.package) { | ||
if (area.bootstrap) { | ||
config.dependencies = []; | ||
} else { | ||
if (!area.bootstrap) { | ||
// during package build each area represents by one .js file | ||
config.scripts = ['scripts/' + area.name + '.min.js']; | ||
for (var i = area.dependencies.length - 1; i >= 0; i--) { | ||
var dependencyArea = findAreaByName(area.dependencies[i]); | ||
if (dependencyArea && dependencyArea.bootstrap) { | ||
area.dependencies.splice(i, 1); | ||
} | ||
} | ||
} | ||
@@ -235,9 +227,9 @@ } else { | ||
if(options.values) { | ||
if(!grunt.file.exists(options.values)){ | ||
if (options.values) { | ||
if (!grunt.file.exists(options.values)) { | ||
grunt.log.error('Values configuration file does not found at: ' + options.values); | ||
return; | ||
} | ||
var valuesConfig = grunt.file.readJSON(options.values); | ||
if(Object.keys(valuesConfig).length){ | ||
var valuesConfig = grunt.file.readJSON(options.values); | ||
if (Object.keys(valuesConfig).length) { | ||
var valuesConfigScript = templates.valuesConfigScript(valuesConfig); | ||
@@ -264,2 +256,27 @@ var fileName = '_values.' + this.target + '.js'; | ||
var appendedAreas = {}; | ||
var appendAreasScriptsToBootstrap = function (area, allScripts, hops) { | ||
if(appendedAreas[area.name]){ | ||
return; // allready appended | ||
} | ||
if (hops > 10) { | ||
grunt.log.error('Cyclic references found at area ' + area.name); | ||
return; | ||
} | ||
if (area.dependencies && area.dependencies.length) { | ||
// if area has dependencies, ensure to append it at first | ||
area.dependencies.forEach(function (areaName) { | ||
var depArea = findAreaByName(areaName); | ||
if (!depArea) { | ||
grunt.log.error('Area "' + areaName + '" not found'); | ||
return; | ||
} | ||
appendAreasScriptsToBootstrap(depArea, allScripts, hops++); | ||
}); | ||
} | ||
allScripts.push.apply(allScripts, area.__scripts); | ||
appendedAreas[area.name] = true; | ||
} | ||
// Build bootstrap scripts first | ||
@@ -280,3 +297,3 @@ var bootstrapScripts = processedBootstrapScripts; | ||
} else { | ||
bootstrapScripts = options.bootstrapScripts.concat(area.__scripts); | ||
appendAreasScriptsToBootstrap(area, bootstrapScripts, 0); | ||
} | ||
@@ -289,2 +306,3 @@ }); | ||
var stylesMinDest = options.packageOutput + '/styles/all.min.css'; | ||
concatConf['jasperbase'] = { | ||
@@ -291,0 +309,0 @@ src: bootstrapScripts, |
44095
964