Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Search | Email

4.3. JS Minification

		
npm install --save-dev gulp-uglify
		
		

gulpfile.js:

		
// including plugins
var gulp = require('gulp');
var uglify = require("gulp-uglify");
 
// task
gulp.task('minify-js', function () {
    gulp.src('./JavaScript/*.js') // path to your files
    .pipe(uglify())
    .pipe(gulp.dest('path/to/destination'));
});
		
		

Run:

		
gulp minify-js