Skip to content

Instantly share code, notes, and snippets.

@devjin0617
Created August 2, 2016 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devjin0617/2c342e0425766a6ab677693ee5cb9418 to your computer and use it in GitHub Desktop.
Save devjin0617/2c342e0425766a6ab677693ee5cb9418 to your computer and use it in GitHub Desktop.
gulp example code
const gulp = require('gulp');
const concat = require('gulp-concat');
const uglify = require('gulp-uglify');
const removeLogs = require('gulp-removelogs');
const debug = require('gulp-debug');
var files = [
'path/to/file.js'
];
gulp.task('build-js', () => {
return gulp.src(files)
.pipe(debug({
title : 'build-js:build:'
}))
.pipe(removeLogs())
.pipe(uglify({
mangle : true,
compress : true
}))
.pipe(concat('app.js'))
.pipe(gulp.dest('public/dist/js/'));
});
// default
gulp.task('default', ['build-js']);
// watch (realtime build)
gulp.task('watch', () => {
gulp.watch(files, ['build-js']);
});
module.exports = gulp;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment