Skip to content
This repository was archived by the owner on Mar 31, 2020. It is now read-only.

Make .env variables available within the processed files (.js, .css, … #540

Closed
wants to merge 1 commit into from

Conversation

iRbouh
Copy link

@iRbouh iRbouh commented Jun 14, 2016

Hi,

Several times I needed to use environment-dependent variables inside sass or js files. Therefore, I used an environment variable preprocessor "jas/gulp-preprocess" plus a dotEnv reader "motdotla/dotenv" to read .env file. The result, I can use .env variables this way:

Inside sass file:

$img-path: '/* @echo MY_CDN_URL */';

Or inside js:

var FacebookAppId = '/* @echo FACEBOOK_APP_ID */';
// @ifdef DEBUG someDebuggingCall() // @endif

I don't know if this the right way to do this ! anyway, I like it :D . I hope you like it too :D.

Best Regards.

@laracasts
Copy link

It's cool - but I don't think we can justify more dependencies when very few people would actually use this.

Thanks, though! Nice idea.

@JeffreyWay JeffreyWay closed this Jun 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants