Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
})
.on('end', function() {
gutil.log(gutil.colors.green(file + ' DONE'));
})
.pipe(source(file))
.pipe(buffer())
.pipe(sourcemap ? sourcemaps.init({loadMaps: true}) : gutil.noop())
// Add transformation tasks to the pipeline here.
.pipe(replace('', hash))
.pipe(ugly ? uglify() : gutil.noop())
.pipe(sourcemap ? sourcemaps.write('./') : gutil.noop())
.pipe(gulp.dest('./build'))
.on('end', function () {
callback();
})
.pipe(reload ? connect.reload() : gutil.noop());
}
function bundle() {
return bundler.bundle()
// log errors if they happen
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.pipe(source(config.outputName))
.pipe(gulp.dest(config.dest))
.pipe(connect.reload());
}
function bundle() {
return bundler.bundle()
// log errors if they happen
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.pipe(source(config.outputName))
.pipe(gulp.dest(config.dest))
.pipe(connect.reload())
}
.pipe(pipe.traceur())
.pipe(gulp.dest('compiled/example'));
});
gulp.task('build_dist', ['build_source_cjs', 'build_source_amd']);
gulp.task('build', ['build_dist', 'build_examples']);
// WATCH FILES FOR CHANGES
gulp.task('watch', function() {
gulp.watch(path.src, ['build']);
});
// WEB SERVER
gulp.task('serve', connect.server({
root: __dirname,
port: 8000,
open: {
browser: 'Google Chrome'
}
}));
// This is a super nasty, hacked release task.
// TODO(vojta): fix gulp-git and clean this up
var git = require('gulp-git');
var through = require('through2');
var exec = require('child_process').exec;
runSequence(
'clean',
['build_source_amd', 'build_source_cjs', 'build_source_es6', 'build_deps'],
done
);
});
// WATCH FILES FOR CHANGES
gulp.task('watch', ['build_source_amd'], function() {
gulp.watch([path.lib, path.util, path.example, path.exampleCopy, path.testLib, path.testExample], ['build_source_amd']);
});
// WEB SERVER
gulp.task('serve', connect.server({
root: [__dirname],
port: 8000,
livereload: false,
open: false
}));
var clientify = require('clientify');
var rename = function(search, replace) {
return through.obj(function(file, enc, done) {
file.path = file.path.replace(search, replace);
this.push(file);
done();
});
};
module.exports = function() {
var gulp = require('gulp');
var connect = require('gulp-connect');
gulp.task('connect', connect.server({
port: 1337,
livereload: false,
middleware: function(connect, options) {
return [
connect.static('./build'),
connect.static('./app')
]
}
}));
}
function rebundle() {
return bundler.bundle()
.on('error', handleError)
.pipe(source('main.js'))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(devBuildDir))
.pipe(connect.reload());
}
function bundle () {
return bundler.bundle()
.pipe(source('bundle.js'))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./dist'))
.pipe(connect.reload())
}
gulp.task('build:styles', function () {
gulp.src('src/less/*.less')
.pipe(less({
paths: [
path.join(__dirname, 'less', 'includes')
]
}))
.pipe(gulp.dest('dist'))
.pipe(cssmin())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('dist'))
.pipe(connect.reload());
});
gulp.task('reload', function () {
return gulp.src(['index.html'])
.pipe(connect.reload())
})