Created
September 16, 2014 15:09
-
-
Save kbshl/56434d768ae1567165f9 to your computer and use it in GitHub Desktop.
Gulp Receipe: Output both a minified and non-minified version
This file contains 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
// Outputting both a minified and non-minified version of your combined JavaScript files can be achieved by using gulp-rename and piping to dest twice (once before minifying and once after minifying): | |
'use strict'; | |
var gulp = require('gulp'); | |
var rename = require('gulp-rename'); | |
var uglify = require('gulp-uglify'); | |
var DEST = 'build/'; | |
gulp.task('default', function() { | |
return gulp.src('foo.js') | |
// This will output the non-minified version | |
.pipe(gulp.dest(DEST)) | |
// This will minify and rename to foo.min.js | |
.pipe(uglify()) | |
.pipe(rename({ extname: '.min.js' })) | |
.pipe(gulp.dest(DEST)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment