It allows you to use CommonJS modules in browser bundled in one file. Supports sourcemaps.
Actual implementation of Stitch object is borrowed from https://github.com/sstephenson/stitch. Inspired by https://github.com/thrillerwu/gulp-stitch.
stitch(file, packages);
file | String | Destination file name |
packanges | Array | string array of package paths related to the directory from where you start your gulp task |
var stitch = require('gulp-stitch-sourcemap');
var sourcemap = require('gulp-sourcemaps');
var coffee = require('gulp-coffee');
gulp.task('stitch', function() {
return gulp.src('./app/**/*.js', './vendor/**/*.js')
.pipe(sourcemaps.init())
.pipe(coffee({bare: true})
.pipe(stitch('bundle.js', ['lib', 'vendor']))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./dist/'));
});