thanpolas / grunt-closure-tools

Google Closure Tools for grunt
MIT License
95 stars 22 forks source link

Allow specifying "create_source_map" for src-dest mapping in compiler task #45

Closed fhurta closed 10 years ago

fhurta commented 10 years ago

I'm providing mapping of src-dest files to closureCompiler and it works great. Now I would need to extend the parameters to specify also source map file - ideally just inferred from dest name by adding .map extension.

Currently, I only can specify single value in 'compilerOpts.create_source_map', which would produce the same file for each output overwriting it in each iteration.

When the file mapping is specified as input (i.e. dest is specified) then if the option "create_source_map" is specified, it's value could be treated as file extension of the dest name. Or there should be some other mechanism how to specify the map file name per dest file.

thanpolas commented 10 years ago

Can you share how you do the mapping of src-dest files?

I need it to plan how this could happen...

How fast do you need this?

fhurta commented 10 years ago

Pretty fast response! :+1:

I described the mapping here: http://stackoverflow.com/questions/20196090/how-could-i-specify-output-file-name-based-on-input-file-name

Regarding the timing - you know - the sooner the better :-) - within week would be perfect. I can fork your rep and extend it by myself but I'd prefer to use your package as I already reference it in my project. I can make the extension and create pull request then if you agree with the proposal..

thanpolas commented 10 years ago

Yup, if you need it you need it i can't argue with that, so this needs to be done. The flow that you'd have to use today would be to create as many build targets as you need compiled files...

To use Grunt's files expansion and have the create_source_map value change for every compilation then you'd beed to mingle with the options in this point https://github.com/closureplease/grunt-closure-tools/blob/master/tasks/closureCompiler.js#L41

Here's a plan

(and write a test case + docs)

I'm not positive i can deliver within a week, i'll do my best. Let me know if you want to send a PR

fhurta commented 10 years ago

Well, I've already checked the source how the compileCommand is built. I'll be happy to contribute. Hopefully I can do that wtihin the week I mentioned..