johnpapa / gulp-patterns

Playground for Gulp Recipes
500 stars 146 forks source link

Target/config profiles support. #83

Closed igorlino closed 9 years ago

igorlino commented 9 years ago

Hi John,

I have done some related-work recently where we target different deployments.

The basic requirement was configuration based on 3 profiles (production, integration/test, local) that included:

The gulp-config works well for project structure/resources related things but it works less good when deployment-related configuration is needed.

What I did was:

The challenge was of course how to keep the configuration working for both: 1)the "production" processed/optimized code/application. (easy case since it just go through the regular gulp stream) 2)the local dev non-optimized. (difficult case)

The reason why #2 is difficult is because the resources js/html are not processed by gulp, therefore no text-replace nor constant js can be generated that would be recognized. I don't like my solution since @@constants_ids has default value in case it does not get replaced. => Effectively making /profile/localdev.json a difficult case. Also, one cannot cleanly update index.html, otherwise, it would be check-in depending on the profile you used on the gulp call. (this is less of a problem, as the root "/" is good enough)

Perhaps there would be a more cleaver way to achieve it ?

(I could provide the changes I did, even if they are clearly ugly.)

Cheers

johnpapa commented 9 years ago

please show them

igorlino commented 9 years ago

Alright :) , the goodies are under: https://github.com/johnpapa/gulp-patterns/pull/89