Catch the traditional-bootstrap up with the latest changes

This commit is contained in:
Kevin MacMartin 2018-05-02 14:52:05 -04:00
parent 830fb4e79b
commit 45e0f05412
2 changed files with 46 additions and 16 deletions

View file

@ -5,11 +5,12 @@ const gulp = require("gulp"),
plumber = require("gulp-plumber"), plumber = require("gulp-plumber"),
concat = require("gulp-concat"); concat = require("gulp-concat");
// Sass packages // Sass and CSS packages
const sass = require("gulp-sass"), const sass = require("gulp-sass"),
sassGlob = require("gulp-sass-glob"), sassGlob = require("gulp-sass-glob"),
postCSS = require("gulp-postcss"), postCSS = require("gulp-postcss"),
autoprefixer = require("autoprefixer"); autoprefixer = require("autoprefixer"),
cleanCSS = require("gulp-clean-css");
// Javascript packages // Javascript packages
const babel = require("gulp-babel"), const babel = require("gulp-babel"),
@ -66,6 +67,14 @@ const jsDashboardLibs = [
"bower_components/simplemde/dist/simplemde.min.js" "bower_components/simplemde/dist/simplemde.min.js"
]; ];
// CSS libraries for the dashboard
const jsDashboardCSS = [
"node_modules/pickadate/lib/themes/default.css",
"node_modules/pickadate/lib/themes/default.date.css",
"bower_components/simplemde/dist/simplemde.min.css",
"bower_components/SpinKit/css/spinners/11-folding-cube.css"
];
// Paths to folders containing fonts that should be copied to public/fonts/ // Paths to folders containing fonts that should be copied to public/fonts/
const fontPaths = [ const fontPaths = [
"resources/assets/fonts/**" "resources/assets/fonts/**"
@ -79,26 +88,40 @@ function handleError(err) {
// Process sass // Process sass
function processSass(filename) { function processSass(filename) {
const css = gulp.src("resources/assets/sass/" + filename + ".scss") const css = gulp.src(`resources/assets/sass/${filename}.scss`)
.pipe(plumber(handleError)) .pipe(plumber(handleError))
.pipe(sassGlob()) .pipe(sassGlob())
.pipe(sass({ outputStyle: sassOutputStyle, includePaths: sassPaths })) .pipe(sass({ outputStyle: sassOutputStyle, includePaths: sassPaths }))
.pipe(postCSS([ autoprefixer(autoprefixerSettings) ])) .pipe(postCSS([ autoprefixer(autoprefixerSettings) ]))
.pipe(concat(filename + ".css")) .pipe(concat(`${filename}.css`))
.pipe(gulp.dest("public/css/")); .pipe(gulp.dest("public/css/"));
if (!isProduction) { if (!isProduction) {
css.pipe(browserSync.stream({ match: "**/" + filename + ".css" })); css.pipe(browserSync.stream({ match: `**/${filename}.css` }));
} }
return css; return css;
} }
// Process css
function processCSS(ouputFilename, inputFiles) {
const css = gulp.src(inputFiles)
.pipe(plumber(handleError))
.pipe(postCSS([ autoprefixer(autoprefixerSettings) ]))
.pipe(concat(`${ouputFilename}.css`));
if (isProduction) {
css.pipe(cleanCSS());
}
return css.pipe(gulp.dest("public/css/"));
}
// Process javascript // Process javascript
function processJavaScript(ouputFilename, inputFiles, es6) { function processJavaScript(ouputFilename, inputFiles, es6) {
const javascript = gulp.src(inputFiles) const javascript = gulp.src(inputFiles)
.pipe(plumber(handleError)) .pipe(plumber(handleError))
.pipe(concat(ouputFilename + ".js")); .pipe(concat(`${ouputFilename}.js`));
if (es6) { if (es6) {
javascript.pipe(babel()); javascript.pipe(babel());
@ -111,6 +134,11 @@ function processJavaScript(ouputFilename, inputFiles, es6) {
return javascript.pipe(gulp.dest("public/js/")); return javascript.pipe(gulp.dest("public/js/"));
} }
// Task for error page styles
gulp.task("sass-error", () => {
return processSass("error");
});
// Task for public styles // Task for public styles
gulp.task("sass-public", () => { gulp.task("sass-public", () => {
return processSass("app"); return processSass("app");
@ -121,9 +149,9 @@ gulp.task("sass-dashboard", () => {
return processSass("dashboard"); return processSass("dashboard");
}); });
// Task for error page styles // Task for dashboard css libraries
gulp.task("sass-error", () => { gulp.task("css-dashboard-libs", () => {
return processSass("error"); return processCSS("lib-dashboard", jsDashboardCSS);
}); });
// Task for public javascript // Task for public javascript
@ -176,15 +204,16 @@ gulp.task("watch", () => {
gulp.watch([ "app/**/*.php", "routes/**/*.php", "resources/views/**/*.blade.php" ], gulp.series(browserSyncReload)); gulp.watch([ "app/**/*.php", "routes/**/*.php", "resources/views/**/*.blade.php" ], gulp.series(browserSyncReload));
gulp.watch(jsPublic, gulp.series("js-public", browserSyncReload)); gulp.watch(jsPublic, gulp.series("js-public", browserSyncReload));
gulp.watch(jsDashboard, gulp.series("js-dashboard", browserSyncReload)); gulp.watch("resources/assets/js/**/dashboard.js", gulp.series("js-dashboard", browserSyncReload));
gulp.watch("resources/assets/sass/**/*.scss", gulp.parallel("sass-public", "sass-dashboard", "sass-error")); gulp.watch("resources/assets/sass/**/*.scss", gulp.parallel("sass-public", "sass-dashboard", "sass-error"));
}); });
// Task to run non-development tasks // Task to run non-development tasks
gulp.task("default", gulp.parallel( gulp.task("default", gulp.parallel(
"sass-error",
"sass-public", "sass-public",
"sass-dashboard", "sass-dashboard",
"sass-error", "css-dashboard-libs",
"js-public", "js-public",
"js-public-libs", "js-public-libs",
"js-dashboard", "js-dashboard",

View file

@ -5,20 +5,21 @@
"dev": "gulp default watch" "dev": "gulp default watch"
}, },
"devDependencies": { "devDependencies": {
"browser-sync": "^2.23.6" "browser-sync": "^2.24.2"
}, },
"dependencies": { "dependencies": {
"autoprefixer": "^8.2.0", "autoprefixer": "^8.4.1",
"babel-core": "^6.26.0", "babel-core": "^6.26.3",
"babel-plugin-transform-runtime": "^6.23.0", "babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.1", "babel-preset-env": "^1.6.1",
"babelify": "^8.0.0", "babelify": "^8.0.0",
"bootstrap": "4.0.0", "bootstrap": "4.1.1",
"es6-promise": "^4.2.4", "es6-promise": "^4.2.4",
"fancy-log": "^1.3.2", "fancy-log": "^1.3.2",
"gsap": "^1.20.4", "gsap": "^1.20.4",
"gulp": "^4.0.0", "gulp": "^4.0.0",
"gulp-babel": "^7.0.1", "gulp-babel": "^7.0.1",
"gulp-clean-css": "^3.9.3",
"gulp-concat": "^2.6.1", "gulp-concat": "^2.6.1",
"gulp-plumber": "^1.2.0", "gulp-plumber": "^1.2.0",
"gulp-postcss": "^7.0.1", "gulp-postcss": "^7.0.1",
@ -30,6 +31,6 @@
"minimist": "^1.2.0", "minimist": "^1.2.0",
"pickadate": "^3.5.6", "pickadate": "^3.5.6",
"popper.js": "^1.14.3", "popper.js": "^1.14.3",
"what-input": "^5.0.5" "what-input": "^5.0.7"
} }
} }