Code Monkey home page Code Monkey logo

gulp-environments's People

Contributors

5n00p4eg avatar azolotov avatar calvinjuarez avatar kenany avatar psrpinto avatar psyho avatar wrozka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gulp-environments's Issues

Trouble setting custom environments / checking active environment

I wanted to create 2 environments, based on my process.env.HOST variable, which should be either "live" or "dev".

var environments = require('gulp-environments');
var liveOnly = environments.make('live');
var devOnly = environments.make('dev');
environments.current(process.env.HOST);
console.log(liveOnly?true:false,devOnly?true:false)

This is on my dev environment, and I know process.env.HOST resolves to "dev". But in the above example, the console logs true true, which according to your docs indicates that both environments are active? Maybe I'm misunderstanding what "active" means, but I took it to mean it's set as the current task.

Also if I use console.log(liveOnly(),devOnly()) i instead get false false, not sure what that's about.

make order of precedence in setting environment know in docs, and consider changing

Given the line current(make(process.env.NODE_ENV || argv.env || "development")); if NODE_ENV is set to anything truthy it'll use that regardless of any other method (as the or is short-circuited) of setting the environment, and otherwise it'll fall to arg.env in the same way, and so forth. Make this clear in the documentation. Also, if NODE_ENV is set to "development" then not even gulp.task('set-prod', production.task); or environments.current(production); will override it

Plus, I think it should be reversed, command line should override NODE_ENV or code, and code should override NODE_ENV.

Thanks for the module!

Conditional compiling (if-else)?

I have files that are supposed to be compiled to temp folder if the NODE_ENV value is development; otherwise, to app folder.

I've tried these 4 ways but all failed:

// the $ sign is gulpLoadPlugins()
const isDev = $.environments.development;
const isProd = $.environments.production;
  1. As what the docs instructed
    .pipe(isDev() ? gulp.dest('temp') : gulp.dest('app'))

  2. With gulp-if
    .pipe($.if(isDev(), gulp.dest('temp'), gulp.dest('app')))

  3. Processing the condition inside the gulp.dest() method
    .pipe(gulp.dest(isDev() ? 'temp' : 'app'))

  4. Both condition piped
    .pipe(isDev(gulp.dest('temp')))
    .pipe(isProd(gulp.dest('app')))

THE RESULT:
Both NODE_ENV values compile files to the same folder.

Removing the parentheses after isDev doesn't solve the problem either.

How to set the environment in Gulp 4 exported tasks?

If I have two tasks written in the default Gulp 4 export mode (task() is deprecated), in example:

exports.development = parallel(css, js, img, fonts, icons);
exports.production = parallel(css, js, img, fonts, icons);

how can I set the environment under which each of these exported task should run form inside the gulpfile (I don't want to use CLI flags)?

The readme says to create a task that sets the environment and run it before the others, what is the correct way to do it by using the default Gulp 4 function definition of tasks, like in the example below?

function setDev(cb) {
  // body omitted
  cb();
}

function setProd(cb) {
  // body omitted
  cb();
}

Option for multiple environments?

I would love to have the ability to do an inline check for production or staging in my gulp tasks, maybe something like the following:

...
    .pipe(environments.in(['production', 'staging'], uglify()))
...or...
    .pipe(environments.not(['production', 'staging'], uglify()))
...

Is there currently a supported way of doing this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.