Created
August 2, 2016 00:58
-
-
Save devjin0617/2c342e0425766a6ab677693ee5cb9418 to your computer and use it in GitHub Desktop.
gulp example code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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