<file_sep>var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var uglify = require('gulp-uglify');
var config = require('../config');

gulp.task('javascript', ['clean'], function () {
  var bundle = browserify(config.js.src, { debug: config.debug }).bundle().pipe(source(config.js.outName));
  if (!config.debug) {
    bundle = bundle.pipe(buffer()).pipe(uglify());
  }
  return bundle.pipe(gulp.dest(config.js.outDir));
});
<file_sep>var path = require('path');
var pkg = require('../package.json');
var prefix = pkg.name + '-' + pkg.version;
var target = 'dist';

var js = {
	src: 'src/index.js',
	outDir: target,
	outName: prefix + '.js'
};

var less = {
	src: 'src/index.less',
	outDir: target,
	outName: prefix + '.css'
};

module.exports = {
	target: target,
	debug: process.env.NODE_ENV !== 'production',
	js: js,
	less: less
};
<file_sep>Frontend Module Snippet
=======================

Build configuration placed in gulp-config/config.js

Development build `npm install`
Production build `NODE_ENV=production npm install`
<file_sep>var gulp = require('gulp');
var less = require('gulp-less');
var minifyCss = require('gulp-minify-css');
var sourceMaps = require('gulp-sourcemaps');
var rename = require('gulp-rename');
var config = require('../config');

gulp.task('styles', ['clean'], function () {
  var bundle = gulp.src(config.less.src);
  if (config.debug) {
    bundle = bundle.pipe(sourceMaps.init()).
      pipe(less()).
      pipe(sourceMaps.write());
  } else {
    bundle = bundle.pipe(less()).
      pipe(minifyCss());
  }
  return bundle.pipe(rename(config.less.outName)).
    pipe(gulp.dest(config.less.outDir));
});
