Commit 3370c337 authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Improve build tasks

The Dojo build now utilizes UglifyJS instead of Closure for
minification and is used as default task. UglifyJS significantly
decreases build time.

The build output has been optimized so only relevant files are copied
to the build dir.
parent 2ee1dc15
......@@ -53,7 +53,7 @@ module.exports = function (grunt) {
// List of layers to build.
layers: [{
name: "libarsnova",
name: "libarsnova/libarsnova",
include: [
"dojo/_base/window",
"dojo/request/xhr",
......@@ -85,10 +85,10 @@ module.exports = function (grunt) {
dojo: {
dist: {
options: {
dojo: "build/dojo/dojo.js",
dojo: tmpdir + "builddeps/dojo/dojo.js",
profile: "build.profile.js",
package: ".",
releaseDir: "build/tmp"
releaseDir: tmpdir
}
}
},
......@@ -108,11 +108,10 @@ module.exports = function (grunt) {
dest: outdir,
dot: true
},
dojo: {
dojoreport: {
expand: true,
flatten: true,
cwd: tmpdir,
src: ["libarsnova/libarsnova.{js,js.map}", "build-report.txt"],
src: "build-report.txt",
dest: outdir
}
},
......@@ -122,11 +121,11 @@ module.exports = function (grunt) {
files: [
{
src: "bower_components/dojo",
dest: "build/dojo"
dest: tmpdir + "builddeps/dojo"
},
{
src: "node_modules/dojo-util",
dest: "build/util"
dest: tmpdir + "builddeps/util"
}
]
}
......@@ -135,12 +134,18 @@ module.exports = function (grunt) {
// Config to allow uglify to generate the layer.
uglify: {
options: {
banner: "<%= " + outprop + ".header%>",
sourceMap: true
},
dist: {
requirejs: {
options: {
banner: "<%= " + outprop + ".header%>"
},
src: ["bower_components/requirejs/require.js", "<%= " + outprop + ".modules.abs %>"],
dest: outdir + "<%= " + outprop + ".layerPath %>"
dest: outdir + "libarsnova.js"
},
dojo: {
src: tmpdir + "libarsnova/libarsnova.js",
dest: outdir + "libarsnova.js"
}
},
......@@ -174,7 +179,7 @@ module.exports = function (grunt) {
layers.forEach(function (layer) {
grunt.task.run("amddepsscan:" + layer.name + ":" + name + ":" + amdloader);
grunt.task.run("amdserialize:" + layer.name + ":" + name + ":" + amdloader + ":" + outprop);
grunt.task.run("uglify");
grunt.task.run("uglify:requirejs");
grunt.task.run("copy:plugins");
});
});
......@@ -189,6 +194,6 @@ module.exports = function (grunt) {
grunt.loadNpmTasks("grunt-shell");
grunt.registerTask("build-requirejs", ["clean", "jshint", "shell:bowerdeps", "amdbuild:amdloader", "amdreportjson:amdbuild", "clean:tmp"]);
grunt.registerTask("build-dojo", ["clean", "jshint", "shell:bowerdeps", "symlink:dojo", "dojo:dist", "copy:dojo"]);
grunt.registerTask("default", ["build-requirejs"]);
grunt.registerTask("build-dojo", ["clean", "jshint", "shell:bowerdeps", "symlink:dojo", "dojo:dist", "uglify:dojo", "copy:dojoreport", "clean:tmp"]);
grunt.registerTask("default", ["build-dojo"]);
};
......@@ -5,7 +5,7 @@ var profile = (function () {
basePath: "./",
action: "release",
mini: true,
layerOptimize: "closure",
layerOptimize: false,
cssOptimize: "comments",
stripConsole: "all",
selectorEngine: "lite",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment