Use default names for required npm packages in gulp

This commit is contained in:
Kevin MacMartin 2017-11-21 19:00:04 -05:00
parent 3e422b555e
commit f9f3cfc5b7

42
gulpfile.js vendored
View file

@ -1,18 +1,18 @@
// include packages // include packages
const gulp = require("gulp"), const gulp = require("gulp"),
gUtil = require("gulp-util"), gutil = require("gulp-util"),
gSass = require("gulp-sass"), plumber = require("gulp-plumber"),
gSassGlob = require("gulp-sass-glob"), concat = require("gulp-concat"),
gConcat = require("gulp-concat"), sass = require("gulp-sass"),
gPlumber = require("gulp-plumber"), sassGlob = require("gulp-sass-glob"),
gUglify = require("gulp-uglify"), postCSS = require("gulp-postcss"),
gBabel = require("gulp-babel"), autoprefixer = require("autoprefixer"),
gPostCSS = require("gulp-postcss"), babel = require("gulp-babel"),
gStripDebug = require("gulp-strip-debug"), stripDebug = require("gulp-strip-debug"),
autoprefixer = require("autoprefixer"); uglify = require("gulp-uglify");
// determine if gulp has been run with --production // determine if gulp has been run with --production
const prod = gUtil.env.production; const prod = gutil.env.production;
// declare plugin settings // declare plugin settings
const sassOutputStyle = prod ? "compressed" : "nested", const sassOutputStyle = prod ? "compressed" : "nested",
@ -66,22 +66,22 @@ function plumberError(err) {
// function to handle the processing of sass files // function to handle the processing of sass files
function processSass(filename) { function processSass(filename) {
return gulp.src("resources/assets/sass/" + filename + ".scss") return gulp.src("resources/assets/sass/" + filename + ".scss")
.pipe(gPlumber(plumberError)) .pipe(plumber(plumberError))
.pipe(gSassGlob()) .pipe(sassGlob())
.pipe(gSass({ outputStyle: sassOutputStyle, includePaths: sassIncludePaths })) .pipe(sass({ outputStyle: sassOutputStyle, includePaths: sassIncludePaths }))
.pipe(gPostCSS([ autoprefixer(autoprefixerSettings) ])) .pipe(postCSS([ autoprefixer(autoprefixerSettings) ]))
.pipe(gConcat(filename + ".css")) .pipe(concat(filename + ".css"))
.pipe(gulp.dest("public/css/")); .pipe(gulp.dest("public/css/"));
} }
// function to handle the processing of javascript files // function to handle the processing of javascript files
function processJavaScript(ouputFilename, inputFiles, es6) { function processJavaScript(ouputFilename, inputFiles, es6) {
const javascript = gulp.src(inputFiles) const javascript = gulp.src(inputFiles)
.pipe(gPlumber(plumberError)) .pipe(plumber(plumberError))
.pipe(gConcat(ouputFilename + ".js")); .pipe(concat(ouputFilename + ".js"));
if (es6) { javascript.pipe(gBabel()); } if (es6) { javascript.pipe(babel()); }
if (prod) { javascript.pipe(gStripDebug()).pipe(gUglify()); } if (prod) { javascript.pipe(stripDebug()).pipe(uglify()); }
return javascript.pipe(gulp.dest("public/js/")); return javascript.pipe(gulp.dest("public/js/"));
} }
@ -118,7 +118,7 @@ gulp.task("js-dashboard-libs", function() {
// gulp task to copy fonts // gulp task to copy fonts
gulp.task("fonts", function() { gulp.task("fonts", function() {
return gulp.src(fontPaths) return gulp.src(fontPaths)
.pipe(gPlumber(plumberError)) .pipe(plumber(plumberError))
.pipe(gulp.dest("public/fonts/")); .pipe(gulp.dest("public/fonts/"));
}); });