Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Gulp: Scripts Minification and Concatenation
/**
* Scripts: Vendors
*
* Look at src/js and concatenate those files, send them to assets/js where we then minimize the concatenated file.
*/
gulp.task('vendorsJs', function() {
return gulp.src(['./assets/js/vendor/*.js', bower+'**/*.js'])
.pipe(concat('vendors.js'))
.pipe(gulp.dest('./assets/js'))
.pipe(rename( {
basename: "vendors",
suffix: '.min'
}))
.pipe(uglify())
.pipe(gulp.dest('./assets/js/'))
.pipe(notify({ message: 'Vendor scripts task complete', onLast: true }));
});
/**
* Scripts: Custom
*
* Look at src/js and concatenate those files, send them to assets/js where we then minimize the concatenated file.
*/
gulp.task('scriptsJs', function() {
return gulp.src('./assets/js/custom/*.js')
.pipe(concat('custom.js'))
.pipe(gulp.dest('./assets/js'))
.pipe(rename( {
basename: "custom",
suffix: '.min'
}))
.pipe(uglify())
.pipe(gulp.dest('./assets/js/'))
.pipe(notify({ message: 'Custom scripts task complete', onLast: true }));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment