I have different sets of JS files that I want to concat and uglify. One is for the app, one is for the website. My gruntfile.js looks something like the one below. The problem is that only the website
one runs even though I have registered the grunt task as: grunt.registerTask('default', ['concat:app', 'concat:website', 'uglify']);
concat: {
app: {
js: {
src: [
'app/js/vendor/jquery.js',
'app/js/app/ui.js',
'app/js/app/data.js'
],
dest: 'app/js/app.js'
},
css: {
src: [
'app/css/vendor/normalize.css',
'app/css/vendor/ui.css',
'app/css/vendor/style.css',
],
dest: 'app/css/app.css'
}
},
website: {
src: [
'app/js/vendor/jquery.js',
'app/js/website/scripts.js'
],
dest: 'app/js/common.js'
}
},
uglify: {
development: {
options: {
preserveComments: false
},
files: {
'app/js/app.min.js': 'app/js/app.js',
'app/js/common.min.js': 'app/js/common.js'
}
}
}
concat can concatenate multiple files and types in the same target, but you have to use the proper grunt syntax (https://www.npmjs.com/package/grunt-contrib-concat#multiple-files-per-target):
concat: {
app: {
'app/js/app.js': [
'app/js/vendor/jquery.js',
'app/js/app/ui.js',
'app/js/app/data.js'
],
'app/css/app.css': [
'app/css/vendor/normalize.css',
'app/css/vendor/ui.css',
'app/css/vendor/style.css',
],
}
},
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments