How to use the gulp.env function in gulp

To help you get started, we’ve selected a few gulp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angular / dgeni / example / gulpfile.js View on Github external
gulp.task('server', function() {
  var port = 8000;
  var build = gulp.env.type || 'default';
  var indexPage = 'index' + (build === 'default' ? '' : '-' + build) + '.html';
  var app = express();
  // Log requests to the console
  app.use(express.logger());
  // If the file exists then supply it
  app.use(express.static('build'));
  // Otherwise just send the index.html for other files to support HTML5Mode
  app.all('/*', function(req, res) {
    res.sendfile(indexPage, { root: 'build' });
  });
  app.listen(port, function() {
    gutil.log('Server listening on port', gutil.colors.magenta(port));
  });
});
github certsimple / rosetta-stone / gulpfile.js View on Github external
gulp.task('js', ['markdown-to-json'], function() {
	// Browserify/bundle the JS.
	browserify({
		entries: './js/src/rosetta-stone.js',
		insertGlobals : true,
		fullPaths: true, // For discify
		debug: ! gulp.env.production
	}).bundle()
		.pipe(source('rosetta-stone.js'))
		.pipe(buffer())
		.pipe(gulpIf(gulp.env.production, uglify()))
		.pipe(gulp.dest('./js/dist'))

});
github zuoge85 / OpenMajiang / client / node-client / Gulpfile.js View on Github external
const fs = require('fs');
const gulp = require('gulp');
const uglify = require('gulp-uglify');
const sourcemaps = require('gulp-sourcemaps');
const plumber = require('gulp-plumber');
const connect = require('gulp-connect');
const rename = require("gulp-rename");
const imagemin = require('gulp-imagemin');
const minifyHTML = require('gulp-minify-html');
const minifyInline = require('gulp-minify-inline');
const htmlAutoprefixer = require("gulp-html-autoprefixer");
const replace = require('gulp-replace');
const gm = require("gm");
const converter = require('image-to-icon-converter');

let VERSION = gulp.env.version;
if (!VERSION) {
    VERSION = "v1";
}

let IS_DEBUG = !gulp.env.release;
let profile = gulp.env.profile;
if (!profile) {
    profile = "gd";
}

let IS_OPTIMIZE_IMG = !!gulp.env.optmize;

console.log("是否调试模式:", IS_DEBUG);
console.log("PROFILE:", profile);
console.log("OPTIMIZE:", IS_OPTIMIZE_IMG);
console.log("版本:", VERSION);
github facebookarchive / puewue-frontend / gulpfile.js View on Github external
gulp.task('sass', function () {
	var sassOpts = {includePaths: [require('node-bourbon').includePaths, './lib/stylesheets']};
	if(gulp.env.production) sassOpts.outputStyle = 'compressed';
	gulp.src(['./bower_components/normalize.css/normalize.css', './lib/stylesheets/application.scss'])
	.pipe(sass(sassOpts))
	.pipe(concat(gulp.env.production ? 'dashboard.min.css' : 'dashboard.css'))
	.pipe(gulp.dest('./build'));
});
github mllrsohn / angular-re-captcha / Gulpfile.js View on Github external
gulp.task('test', function() {
    gulp.src([
        'test/mocha.conf.js',
        'bower_components/angular/angular.js',
        'bower_components/angular-mocks/angular-mocks.js',
        'angular-re-captcha.js',
        'test/unit/**/*.js'
    ]).pipe(karma({
        configFile: './test/karma.config.js',
        action: (gulp.env.travis ? 'run' : 'watch'),
        browsers: (gulp.env.travis ? ['Firefox'] : ['Chrome']),
        singleRun: (gulp.env.travis ? true : false),
    }));
});
github platanus / angular-push / gulpfile.js View on Github external
gulp.task('bump', function () {
  return gulp.src(['./bower.json', './package.json'])
    .pipe(bump({type: gulp.env.type}))
    .pipe(gulp.dest('./'));
});
github edrex / pillowfork / Gulpfile.js View on Github external
var gulp = require('gulp'),
    exec = require('gulp-exec'),
    protractor = require("gulp-protractor"),
    lr = require('tiny-lr'),
    livereload = require('gulp-livereload'),
    server = lr(),
    sourceStream = require('vinyl-source-stream'),
    browserify = require('browserify'),
    concat = require('gulp-concat');

var env = gulp.env.prod ? 'prod' : 'local';
var src = './app/',
    dest = './couchapp/_attachments/';

var scripts = [
  src+'components/lodash/dist/lodash.js',
  src+'components/pouchdb-nightly/index.js',
  src+'components/angular/angular.js',
  src+'components/angular-route/angular-route.js',
  src+'components/angular-sanitize/angular-sanitize.js',
  src+'assets/app.js'
];
var styles = [
  src+'components/normalize-css/normalize.css',
  src+'styles/app.css'
]
github mimorisuzuko / chain / gulpfile.js View on Github external
gulp.task('scripts', () => {
	gulp.src('src/index.js')
		.pipe(plumber({ errorHandler: notify.onError('<%= error.message %>') }))
		.pipe(browserify({
			insertGlobals: true,
			debug: !gulp.env.production
		}))
		.pipe(gulp.dest('./play'));
});
github GabLeRoux / ansi-colors-chrome-extension / gulpfile.babel.js View on Github external
gulp.task('babel', () => {
  return gulp.src('app/scripts.babel/**/*.js')
      .pipe($.babel({
        presets: ['es2015']
      }))
      .pipe(browserify({
        insertGlobals : true,
        debug : !gulp.env.production
      }))
      .pipe(gulp.dest('app/scripts'));
});
github erizocosmico / Sunglasses / client / Gulpfile.js View on Github external
gulp.task('sass', function() {
    gulp.src(paths.sass)
        .pipe(sass({
            outputStyle: 'compressed',
            errLogToConsole: gulp.env.watch
        }))
        .pipe(gulp.dest('../public/css'));
});