grunt-bower-concat icon indicating copy to clipboard operation
grunt-bower-concat copied to clipboard

Create sourcemap for concatenated files

Open marcelboettcher opened this issue 10 years ago • 6 comments

Any chance to integrate grunt-concat-sourcemap so you can see in which original file an error occurred? It's very helpful during development.

Thanks a lot!

marcelboettcher avatar Oct 22 '14 12:10 marcelboettcher

Good idea, but pull request are welcome. I’m not sure I’ll have time to implement it soon.

sapegin avatar Oct 22 '14 17:10 sapegin

If it's any help, I created a fork which supports this, but it uses grunt-contrib-uglify under the covers (which isn't necessarily the cleanest solution, calling uglify directly would be better but involves a lot more work) - see https://github.com/mattgoldspink/grunt-bower-concat. To use just add an uglifyOptions property and anything you set there will be passed through to grunt-contrib-uglify task.

mattgoldspink avatar Mar 19 '15 08:03 mattgoldspink

@mattgoldspink Why do you use Uglify for source maps?

sapegin avatar Mar 19 '15 08:03 sapegin

@sapegin Although we could've used the mozilla sourcemap node lib directly, we also wanted to minify the code as well as thats where the real benefit of sourcemaps comes from. The current code in grunt-bower-concat would take of the concat step and then we'd want to minify, but if you've already sourcemapped the concat'd files, you won't be able to sourcemap again the minified files if it is an extra step. So to take care of concat, minification and sourcemap in one go it was easier to use uglify. I hope that makes sense.

mattgoldspink avatar Mar 19 '15 08:03 mattgoldspink

@mattgoldspink Maybe. I’m not sure ;-) But I’m sure that using uglify itself would be much better that grunt-contrib-uglify.

sapegin avatar Mar 19 '15 08:03 sapegin

@sapegin Agreed - hence why I'm not issuing a pull request. I had similar code in an older grunt plugin I wrote that did things this way be shelling out, so it was a super quick solution to our needs.

mattgoldspink avatar Mar 19 '15 08:03 mattgoldspink