UNPKG

gulp-clientappcompile

Version:

Gulp tasks for compiling all js into one single file. Based on gulp-este.

34 lines (29 loc) 952 B
var gulp; gulp = require('gulp'); /** @param {(string|Array.<string>)} paths @return {Stream} Node.js Stream. */ module.exports = function(paths, buildPath) { var concat, cond, eventStream, minifyCss, pathOs, streams, stylus, watchMode; cond = require('gulp-cond'); eventStream = require('event-stream'); minifyCss = require('gulp-minify-css'); concat = require('gulp-concat'); stylus = require('gulp-stylus'); pathOs = require('path'); watchMode = !!this.changedFilePath; if (!Array.isArray(paths)) { paths = [paths]; } streams = paths.map((function(_this) { return function(path) { return gulp.src(path, { base: '.' }).pipe(stylus({ errors: true })).pipe(gulp.dest('.')).pipe(concat(pathOs.basename(buildPath))).pipe(cond(_this.production, minifyCss())).pipe(gulp.dest(pathOs.dirname(buildPath))); }; })(this)); return eventStream.merge.apply(eventStream, streams); };