Skip to content

Commit

Permalink
VP-310: Added compression
Browse files Browse the repository at this point in the history
Added tasks to compress the various build types to a zip files.
  • Loading branch information
jobara committed May 3, 2013
1 parent 07a18e9 commit 6244880
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -5,3 +5,4 @@ html/test.php
# build resources to ignore
node_modules
build
products
29 changes: 27 additions & 2 deletions GruntFile.js
@@ -1,7 +1,30 @@
module.exports = function (grunt) {
grunt.initConfig({
clean: {
build: "build"
build: "build",
products: "products"
},
compress: {
src: {
options: {
archive: "products/videoPlayer-all.zip"
},
files: [
// expand makes the src relative to cwd path, and flatten collapses the file down to the cwd directory
{src: ["build/videoPlayer-all.js"], dest: "./", expand: true, cwd: "./", flatten: true},
{src: ["css/**", "demos/**", "docs/**", "html/**", "images/**", "js/**", "lib/**", "tests/**"], dest: "./"}
]
},
min: {
options: {
archive: "products/videoPlayer-all-min.zip"
},
files: [
// expand makes the src relative to cwd path, and flatten collapses the file down to the cwd directory
{src: ["build/videoPlayer-all-min.js"], dest: "./", expand: true, cwd: "./", flatten: true},
{src: ["css/**", "demos/**", "docs/**", "html/**", "images/**", "js/**", "lib/**", "tests/**"], dest: "./"}
]
}
},
concat: {
all: {
Expand Down Expand Up @@ -39,9 +62,11 @@ module.exports = function (grunt) {

grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-compress");
grunt.loadNpmTasks("grunt-contrib-uglify");

grunt.registerTask("build-src", ["clean", "concat"]);
grunt.registerTask("build-min", ["build-src", "uglify"]);
grunt.registerTask("default", ["build-min"]);
grunt.registerTask("build", ["build-min", "compress", "clean:build"]);
grunt.registerTask("default", ["build"]);
};
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -31,6 +31,7 @@
"grunt": "~0.4.1",
"grunt-contrib-clean": "~0.4.1",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-uglify": "~0.2.0"
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-compress": "~0.5.0"
}
}

0 comments on commit 6244880

Please sign in to comment.