Skip to content

Instantly share code, notes, and snippets.

@ahmadawais
Last active August 29, 2015 14:28
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 ahmadawais/48ec5b8737ae6a525b16 to your computer and use it in GitHub Desktop.
Save ahmadawais/48ec5b8737ae6a525b16 to your computer and use it in GitHub Desktop.
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