Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zebrajaeger/gulp-simple-env
Simple Environment Plugin for Gulp
https://github.com/zebrajaeger/gulp-simple-env
Last synced: 9 days ago
JSON representation
Simple Environment Plugin for Gulp
- Host: GitHub
- URL: https://github.com/zebrajaeger/gulp-simple-env
- Owner: zebrajaeger
- License: lgpl-3.0
- Created: 2019-02-02T11:45:58.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-02T12:52:10.000Z (almost 6 years ago)
- Last Synced: 2024-10-05T08:11:37.111Z (about 1 month ago)
- Language: JavaScript
- Size: 47.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# gulp-simple-env
[![NPM version][npm-image]][npm-url]
[![License][license-image]][license-url]
[![Size][size-image]][size-url]## Define your environments
I.E. we define two environments: 'foo' and 'bar'.const e = require('@zebrajaeger/gulp-simple-env')({
env: ['foo', 'bar']
});You can define as much environments as you want.
Hint:
For js-conform naming, the env-names are camel-cased. 'my-great-env' becomes to isMyGreatEnv(...).
The command line name is unchanged: gulp --my-great-env
For the replacement strategy, take a look at https://www.npmjs.com/package/camelcase## Activate environment through command line argument(s)
gulp --foo
gulp --bar
gulp --foo --bar## Generic: Check if a specific environment is (not) set
e.isFoo(): true or false
e.isNotFoo(): true or false
e.isBar(): true or false
e.isNotBar(): true or false## Gulp: Execute tasks dependent from environment
gulp.src(...).pipe( e.isFoo(...) ).dest(...);
gulp.src(...).pipe( e.isNotFoo(...) ).dest(...);
gulp.src(...).pipe( e.isBar(...) ).dest(...);
gulp.src(...).pipe( e.isNotBar(...) ).dest(...);As an alternative you can provide a trueStream and a falseStream
.pipe( e.isFoo(uglify(), prettify()) )
## Your example gulpfile.js
const g = require('gulp');
const e = require('@zebrajaeger/gulp-simple-env')({env: ['foo', 'bar']});
const print = require('gulp-print').default;
g.task('default', cb => {
return g
.src('*.js')
.pipe(e.isFoo(print()))
});[npm-image]: https://img.shields.io/npm/v/@zebrajaeger/gulp-simple-env.svg?style=flat
[npm-url]: https://npmjs.org/@zebrajaeger/gulp-simple-env[license-image]: https://img.shields.io/github/license/zebrajaeger/gulp-simple-env.svg?style=flat
[license-url]: https://github.com/zebrajaeger/gulp-simple-env/blob/master/LICENSE.txt[size-image]: https://img.shields.io/github/size/zebrajaeger/gulp-simple-env/index.js.svg?style=flat
[size-url]: https://github.com/zebrajaeger/gulp-simple-env/blob/master/index.js