I use concat to merge JS files into one file and uglify to minimize the JavaScript. How can I create a sourcemaps file that uses the source JS files?
My current gru
You need to enable source maps on both the concat
and uglify
tasks, and you must specify the sourceMapIn
option for the uglify task.
Here's a sample grunt config:
concat : {
options : {
sourceMap :true
},
dist : {
src : ['www/js/**/*.js'],
dest : '.tmp/main.js'
}
},
uglify : {
options : {
sourceMap : true,
sourceMapIncludeSources : true,
sourceMapIn : '.tmp/main.js.map'
},
dist : {
src : '<%= concat.dist.dest %>',
dest : 'www/main.min.js'
}
}