Skip to content

Instantly share code, notes, and snippets.

@mgsmus
Last active December 2, 2015 06:04
Show Gist options
  • Save mgsmus/70394305e68a268d5fc3 to your computer and use it in GitHub Desktop.
Save mgsmus/70394305e68a268d5fc3 to your computer and use it in GitHub Desktop.
Sample gulpfile.js
"use strict";
var gulp = require('gulp'); // 4.0
var del = require('del');
var publicPath = "public_html";
var bowerComponentsPath = ".bower_components";
var vendorPath = publicPath + "/assets/vendor";
var paths = {
jquery: {
src: bowerComponentsPath + "/jquery/dist/jquery.min.js",
dest: vendorPath + "/jquery"
},
bootstrap: {
src: bowerComponentsPath + "/bootstrap/dist/**/*",
dest: vendorPath + "/bootstrap"
},
fontawesome: {
src: bowerComponentsPath + "/fontawesome/**/*",
dest: vendorPath + "/font-awesome"
},
slippry: {
src: bowerComponentsPath + "/slippry/**/*",
dest: vendorPath + "/slippry"
}
};
gulp.task('jquery', function () {
return gulp.src(paths.jquery.src)
.pipe(gulp.dest(paths.jquery.dest));
});
gulp.task('bootstrap', function () {
return gulp.src(paths.bootstrap.src)
.pipe(gulp.dest(paths.bootstrap.dest))
.on('end', function () {
del([
vendorPath + '/bootstrap/css/*.*',
'!' + vendorPath + '/bootstrap/css/bootstrap.min.css',
'!' + vendorPath + '/bootstrap/css/bootstrap.css.map',
vendorPath + '/bootstrap/js/bootstrap.js',
vendorPath + '/bootstrap/js/npm.js',
]);
});
});
gulp.task('fontawesome', function () {
return gulp.src(paths.fontawesome.src)
.pipe(gulp.dest(paths.fontawesome.dest))
.on('end', function () {
del([
vendorPath + '/font-awesome/css/font-awesome.css',
vendorPath + '/font-awesome/less',
vendorPath + '/font-awesome/scss',
vendorPath + '/font-awesome/bower.json'
]);
});
});
gulp.task('slippry', function () {
return gulp.src(paths.slippry.src)
.pipe(gulp.dest(paths.slippry.dest))
.on("end", function () {
del([
vendorPath + "/slippry/*",
"!" + vendorPath + "/slippry/dist",
"!" + vendorPath + "/slippry/images"
])
});
});
/**
* Delete vendor directory (for debugging)
*/
gulp.task('rollback', function (cb) {
del([vendorPath], cb);
});
gulp.task('default', gulp.series('jquery', 'bootstrap', 'fontawesome', 'slippry'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment