sapegin / grunt-bower-concat

Bower components concatenator for Grunt
MIT License
220 stars 72 forks source link

Create sourcemap for concatenated files #34

Open marcelboettcher opened 9 years ago

marcelboettcher commented 9 years ago

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!

sapegin commented 9 years ago

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

mattgoldspink commented 9 years ago

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.

sapegin commented 9 years ago

@mattgoldspink Why do you use Uglify for source maps?

mattgoldspink commented 9 years ago

@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.

sapegin commented 9 years ago

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

mattgoldspink commented 9 years ago

@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.