Package automation for Veeva [Deep] Presentations
module.exports = function(grunt) {
var copy_src = ['css/**',
'js/main.min.js',
'*.html',
'images/**',
'*.jpg'];
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: {
main: {
src: [ 'js/main.min.js', 'PROJECT_NAME/**', '*.zip' ]
}
},
copy: {
build: {
src: copy_src,
dest: 'PROJECT_NAME/',
expand: true
}
},
uglify: {
options: {
compress: {
drop_console: true
}
},
build_target: {
files: {
'js/main.min.js': [
'list_of_js_files/file.js'
] //concat in same order as HTML
}
}
},
processhtml: {
build: {
files: {
'PROJECT_NAME/index.html': ['PROJECT_NAME/index.html']
}
}
},
compress: {
PROJECT_NAME: {
options: {
archive: 'PROJECT_NAME.zip'
},
files: [
{src: ['PROJECT_NAME/**'], dest: '/', filter: 'isFile'}, // includes files in path
]
}
},
rename: {
index_to_PROJECT_NAME: {
files: [
{src: ['PROJECT_NAME/index.html'], dest: 'PROJECT_NAME/PROJECT_NAME.html'},
]
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-processhtml');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-rename');
grunt.registerTask(
'build',
'Outputs and compresses files for production in the build directory',
[ 'clean', 'uglify', 'copy', 'processhtml', 'rename', 'compress' ]
);
}