Munter / grunt-reduce

A grunt kitchen that reduces your web ingredients down to their essence for optimal serving. Bon appétit!
MIT License
184 stars 13 forks source link

convert to multitask? #17

Open WickyNilliams opened 9 years ago

WickyNilliams commented 9 years ago

It would be awesome if this allowed you to define multiple reduce tasks (a "multitask" in grunt parlance) like:

reduce : {
  appOne : {
    // whatever
  },
  appTwo : {
    // something else
  }
}

then i could run grunt reduce:appOne to target a specific build or grunt reduce to build them all

Munter commented 9 years ago

Agreed. I want to do this both for grunt-reduce and it's development loop cousin grunt-livestyle

WickyNilliams commented 9 years ago

Thanks, good to know it's a reasonable suggestion.

It might also be nice if globbing was supported:

reduce: {
  root : "apps/**"
}

This might come in handy if i had multiple targets that all wanted similar config? Might be breaking the paradigm though - not sure.

Munter commented 9 years ago

Globbing will never work for the root setting. There has to be an authoritative single root that assetgraph can use to determine root relative urls from. So if you want to have several different apps at different roots, a multitask would be the solution

WickyNilliams commented 9 years ago

OK, yeah that makes perfect sense

WickyNilliams commented 9 years ago

I've managed to get this working as a multitask - would you accept a PR for that?

I've done the absolute bare minimum to convert it, so it's really a small change. I've left the slightly more involved stuff - e.g. setting up the defaults with grunt's this.options(defaults) - for you to do (there was some logic around defaults i didn't want to risk breaking)

Munter commented 9 years ago

That would be awesome! PR away :tada:

WickyNilliams commented 9 years ago

Sweet. I had it mixed in with a load of other changes (i'm working on a dumb fork, that just inlines everything, every time), so i'll isolate, test again and submit as PR