Automatic zip creating Grunt

This commit is contained in:
Mahdi Dibaiee 2014-02-21 16:45:17 +03:30
parent 2a99139364
commit 4bf38eb66a
6 changed files with 22 additions and 5 deletions

View File

@ -3,6 +3,7 @@ module.exports = function(grunt) {
grunt.initConfig({ grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), pkg: grunt.file.readJSON('package.json'),
manifest: grunt.file.readJSON('Mobile/manifest.webapp'),
uglify: { uglify: {
main: { main: {
files: [ files: [
@ -93,6 +94,23 @@ module.exports = function(grunt) {
} }
}, },
zip: {
mobile: {
router: function(path) {
return /build\/mobile\/(.*)/.exec(path)[1];
},
src: 'build/mobile/**',
dest: 'build/sketchy-mobile-<%= manifest.version %>.zip'
},
web: {
router: function(path) {
return /build\/web\/(.*)/.exec(path)[1];
},
src: 'build/web/**',
dest: 'build/sketchy-web-<%= manifest.version %>.zip'
}
},
watch: { watch: {
js: { js: {
files: ['Shared/js/**', 'Mobile/js/**', 'Web/js/**'], files: ['Shared/js/**', 'Mobile/js/**', 'Web/js/**'],
@ -122,6 +140,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['uglify','copy', 'less']) grunt.loadNpmTasks('grunt-zip');
grunt.registerTask('default', ['uglify','copy', 'less', 'zip'])
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -15,7 +15,8 @@
"grunt-contrib-less": "~0.9.0", "grunt-contrib-less": "~0.9.0",
"grunt-contrib-uglify": "~0.2.2", "grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-copy": "~0.5.0", "grunt-contrib-copy": "~0.5.0",
"grunt-contrib-watch": "~0.5.3" "grunt-contrib-watch": "~0.5.3",
"grunt-zip": "~0.12.0"
}, },
"keywords": [ "keywords": [
"Sketch", "Sketch",
@ -24,7 +25,4 @@
], ],
"author": "Mahdi Dibaiee", "author": "Mahdi Dibaiee",
"license": "GPL V2", "license": "GPL V2",
"devDependencies": {
"grunt": "~0.4.2"
}
} }