Created
November 14, 2016 01:00
-
-
Save craigsimps/9b95b19e425ccbf2b88be0c9cf25cf0e to your computer and use it in GitHub Desktop.
Concatenate & Minify Bower JS & CSS Files
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
// Include Gulp. | |
var gulp = require('gulp'); | |
// Include config. | |
var config = require('../tasks/config').vendor; | |
// Include Plugins. | |
var vendorFiles = require('bower-files')({ | |
cwd: config.path | |
}), | |
concat = require('gulp-concat'), | |
uglifyjs = require('gulp-uglify'), | |
uglifycss = require('gulp-uglifycss'), | |
notify = require('gulp-notify'); | |
// Vendor task runs both vendorJS & VendorCSS functions.. | |
gulp.task('vendor', ['vendor-js', 'vendor-css'], function() { | |
return notify({message: config.message}); | |
}); | |
gulp.task('vendor-js', function () { | |
gulp.src(vendorFiles.ext('js').files) | |
.pipe(concat('vendor.min.js')) | |
.pipe(uglifyjs()) | |
.pipe(gulp.dest(config.jsoutput)); | |
}); | |
gulp.task('vendor-css', function () { | |
gulp.src(vendorFiles.ext('css').files) | |
.pipe(concat('vendor.min.css')) | |
.pipe(uglifycss({ | |
"maxLineLen": 80, | |
"uglyComments": true | |
})) | |
.pipe(gulp.dest(config.cssoutput)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment