Feature Request: Environment switching
It would be great if this plugin could be used to provide an automated, build-time way to switch html back and forth between unminified dev versions and minified prod versions of JS files. This could be done by directly updating the HTML, but it might be nicer if it worked something like this:
- Html references a js file that is generated by the plugin
- When in DEV/UNMINIFIED mode, the generated js file uses Steal.js or Require.js (also configurable), to pull in dependencies as individual files
- When in PROD/MINIFIED mode, the the generated JS file could just be the minified js file itself
- A similar system could perhaps also be used to apply version numbers to the scheme?
Thanks for the cool plugins. I've just started using them, but so far they're a great solution to an annoying problem.
I've been thinking about how to use properties to do this. How it'd work is you'd invoke gradle -Penv=dev taskName which would default to the DEV environment. That work for you?
I think that'd work. I wonder if the simple name 'env' wouldn't eventually collide with other plugins? Should it maybe be 'jsenv' and 'cssenv' instead?
It might also be nice to have some sort of cascading overrides. So it'd default to dev, but you can override it either in the gradle script, or if you pass in the script property, that'll override both. That way teams have the option of picking their own "default" value for each script. Also, if you have multiple js files, you might want some to always remain uncompressed, unminified, etc. I guess in that case, you might not want to override the value in the script.
Hmmm....
On Thu, Dec 15, 2011 at 6:30 PM, Eric Wendelin < [email protected]
wrote:
I've been thinking about how to use properties to do this. How it'd work is you'd invoke
gradle -Penv=dev taskNamewhich would default to the DEV environment. That work for you?
Reply to this email directly or view it on GitHub: https://github.com/eriwen/gradle-js-plugin/issues/3#issuecomment-3171565
Related, see issue #12 - I recommend doing it the way I suggest there until we get this figured out.