Currently, the concat and uglify settings are:
concat: {
options: {
// options
},
angular: {
src: ['public/**/*.js', '!public/**/*.min.js', '!public/lib/**/*.js'],
dest: 'build/_main.js',
}
},
uglify: {
options: {
mangle: false,
sourceMap: true,
},
app: {
files: {
'public/js/app.min.js': ['build/_main.js']
}
},
bower: {
files: {
'public/js/lib.min.js': ['build/_bower.js']
}
}
},
This creates one source map in the dev tools under Sources. This source map is usable but I would way rather be able to search file by file and navigate through every file in the dev tools. It would be nice if the entire project directory and file structure was preserved so I could search and navigate through each file and add debuggers, etc.
How do I do this?
This can be achieved by configuring your tasks as follows:
Note: Both solutions below will require the
concattask to be run before theuglifytask.1. Using default generated names for source maps:
Explanation
In your
concattask you need to firstly set thesourceMapoption totrue. Given your current configuration this will create a source map file at the following path:build/_tsbc.js.mapNote: the location of the generated map file defaults to the same
destpath as defined in theangulartarget of theconcattask - with the additional.mapsuffix appended.Then in your
uglifytask add thesourceMapInoption and set its value (String) to the path of the.mapfile generated at stage one above. I.e.2. Explicitly defined names for source maps:
It's also possible to define the specific name and path for the source map file generated by the
concattask. For example:Explanation
Same as before, set the
sourceMapoption totrueThis time, add the
sourceMapNameoption and specify the path of the generated source map.Note: the location of the generated map file is now set to:
'build/my_map.map'Again, in your
uglifytask add thesourceMapInoption and set its value to the same path specified in the previous point. I.e.EDIT
I've just noticed that your
bowertarget in theuglifytask does not depend on output from the previousconcattask. For this scenario you'll need to nest theoptionsobject in each target. For example: