Reputation: 16873
Breakpoints not breaking in browser from source-maps generated using grunt task of yeoman-angular-generator
. The code has been concatenated and minified.
I have looked at this Stack Overflow answer for the configuration of the grunt task and have generated what I think is the correct source-map using the following grunt config:
concat : {
options : {
sourceMap :true
}
},
uglify: {
options: {
sourceMap: true,
sourceMapIncludeSources : true,
sourceMapIn : '.tmp/concat/scripts/scripts.js.map'
}
},
Has anyone used the yeoman-angular-generator
and managed to concat then minify their code and generate source-maps from it? What steps are needed to make it work?
I need to concat and minify my code. Getting source-maps to work with JUST minification is easy or JUST concatenation is also easy but with BOTH concat and minify it seems to not work so well.
Is there a solution to this?
Upvotes: 2
Views: 376
Reputation: 271
I was able to do this, changing the usemin configuration and adding some properties to the concat/uglify configuration object. But attention, the dist files produced by this options are not good for production!
useminPrepare: {
html: '<%= yeoman.app %>/index.html',
options: {
dest: '<%= yeoman.dist %>',
flow: {
html: {
steps: {
js: ['concat', 'uglifyjs'],
css: ['cssmin']
},
post: {
js: [{
name: 'uglify',
createConfig: function (context, block) {
var generated = context.options.generated;
generated.options = {
stripBanners: true,
mangle: false,
sourceMap: true,
sourceMapIncludeSources: true,
compress: false,
beautify: true
};
}
},
{
name: 'concat',
createConfig: function (context, block) {
var generated = context.options.generated;
generated.options = {
//stripBanners: true,
//mangle: false,
sourceMap: true,
sourceMapIncludeSources: true,
separator: ';',
};
}
}]
}
}
}
}
}
Upvotes: 0