4 ms·
With gulp; var gulp = require('gulp'), concat = require('gulp-concat'), uglify = require('gulp-uglify'); gulp.task('js', function(){
by onion2k 11y ago
With gulp;
var gulp = require('gulp'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify');
gulp.task('js', function(){
return gulp.src(['src/**/*.js'])
.pipe(concat('build.js'))
.pipe(uglify())
.pipe(gulp.dest('.'));
});
gulp.task('default', ['js']);
With grunt;
module.exports = function (grunt) {
grunt.initConfig({
concat: {
js: {
files: {'build.js': 'src/**/*.js' }
}
},
uglify: {
bundle: {
files: {'build.min.js': 'bundle.js'}
}
}
});
The bash script is easier for such a trivial job. Gulp and Grunt aren't better if that's all you're doing. They come in to their own when you have a large number of tasks to run. But even then, if you (and your team) prefer make then it's better to use make.