1.0.0 • Published 6 years ago

gulp-dotenv-js v1.0.0

Weekly downloads
29
License
MIT
Repository
github
Last release
6 years ago

Gulp dotenv js

GitHub last commit Latest Stable Version Jarvis approved GitHub license Twitter

A .env file plugin for gulp: compiling .env to js

Install

Gulp-dotend-js require gulp-rename for change name

$ npm install gulp-rename --save

next you install gulp-dotenv-js

$ npm install gulp-dotenv-js --save

Use

Include gulp-dotenv-js and gulp-rename

var dotenv = require('gulp-dotenv-js');
var rename = require('gulp-rename');

gulp.task('dotenv', function () {
  return gulp.src('.env')
    .pipe(dotenvjs())
    .pipe(rename('env.js'))
    .pipe(gulp.dest('dist'));
});

Include

Include env.js file

<script src="assets/dist/js/env.js"></script>

end you can use window.ENV with your options

License

MIT License