Gulp Filter With Sourcemaps
I had a similar question here that has merged into a bit more research on my part and a new way this could work. Basically I'm trying to have all of my .js and .coffee files within
Solution 1:
I guess you wrapped the sourcemaps.init()
and sourcemaps.write()
around the wrong section of your pipe. I put the commands where I assume they belong. See below.
I used gulp-filter
quite a few times as well. However, I kept it to a minimum to not overcomplicate things. I found run-sequence
very helpful. (Also check out some of my gulpfiles here and here.)
Your scenario I would approach like this:
var runSequence = require('run-sequence');
// ...
gulp.task('scripts', function (done) {
runSequence('lint', 'build', done);
});
gulp.task('lint', function (done) {
runSequence('lint-coffee', 'lint-js', done);
});
gulp.task('lint-coffee', function () {
// Just lint your coffee files here...
});
gulp.task('lint-js', function () {
// Just lint your js files here...
});
gulp.task('build', function () {
return gulp.src([
'assets/js/src/_init.coffee',
'assets/js/src/_init.js'
])
.pipe(coffeeFilter)
.pipe(coffee({bare: true}).on('error', gutil.log))
.pipe(coffeeFilter.restore())
.pipe(sourcemaps.init())
.pipe(concat('scripts.min.js'))
.pipe(uglify())
.pipe(sourcemaps.write('../../maps'))
.pipe(gulp.dest(jsBuildDir));
});
Post a Comment for "Gulp Filter With Sourcemaps"