Migrated to gulp 4

This commit is contained in:
Robin C Samuel
2020-05-07 23:44:48 +05:30
parent b5901863c2
commit 5b44fcdd2b
5 changed files with 1416 additions and 979 deletions

View File

@@ -14,6 +14,10 @@ const templatePath = [
]; ];
module.exports = gulp => { module.exports = gulp => {
const reloadBrowser = done => {
browserSync.reload();
done();
};
// run `jekyll build` // run `jekyll build`
gulp.task('jekyll-build', done => { gulp.task('jekyll-build', done => {
return cp.spawn(jekyll, ['build'], { stdio: 'inherit' }).on('close', done); return cp.spawn(jekyll, ['build'], { stdio: 'inherit' }).on('close', done);
@@ -29,19 +33,20 @@ module.exports = gulp => {
}); });
// Rebuild Jekyll then reload the page // Rebuild Jekyll then reload the page
gulp.task('jekyll-rebuild', ['jekyll-dev'], () => { gulp.task('jekyll-rebuild', gulp.series(['jekyll-dev', reloadBrowser]));
browserSync.reload();
});
gulp.task('serve', ['jekyll-dev'], () => { gulp.task(
browserSync.init({ 'serve',
server: { gulp.series('jekyll-dev', () => {
baseDir: '_site', browserSync.init({
}, server: {
}); baseDir: '_site',
},
});
gulp.watch(scssPath, ['sass', browserSync.reload]); gulp.watch(scssPath, gulp.series(['sass', reloadBrowser]));
gulp.watch(jsPath, ['scripts', browserSync.reload]); gulp.watch(jsPath, gulp.series(['scripts', reloadBrowser]));
gulp.watch(templatePath, ['jekyll-rebuild']); gulp.watch(templatePath, gulp.task('jekyll-rebuild'));
}); })
);
}; };

View File

@@ -17,7 +17,7 @@ module.exports = gulp => {
) )
.pipe( .pipe(
prefix({ prefix({
browsers: ['last 2 versions'], overrideBrowserslist: ['last 2 versions'],
cascade: false, cascade: false,
}) })
) )

View File

@@ -8,4 +8,4 @@ const sync = require('./build/browsersync');
task(gulp); task(gulp);
}); });
gulp.task('build', ['sass', 'scripts', 'images', 'jekyll-build']); gulp.task('build', gulp.series(['sass', 'scripts', 'images', 'jekyll-build']));

2350
package-lock.json generated
View File

File diff suppressed because it is too large Load Diff

View File

@@ -9,7 +9,7 @@
"homepage": "https://github.com/bchiang7/bchiang7.github.io", "homepage": "https://github.com/bchiang7/bchiang7.github.io",
"main": "gulpfile.js", "main": "gulpfile.js",
"scripts": { "scripts": {
"start": "gulp serve", "start": "gulp serve --watch",
"build": "gulp build" "build": "gulp build"
}, },
"author": "Brittany Chiang", "author": "Brittany Chiang",
@@ -17,12 +17,12 @@
"devDependencies": { "devDependencies": {
"@nuscout/eslint-config": "^0.2.1", "@nuscout/eslint-config": "^0.2.1",
"browser-sync": "^2.26.7", "browser-sync": "^2.26.7",
"gulp": "^3.9.1", "gulp": "^4.0.0",
"gulp-autoprefixer": "^6.1.0", "gulp-autoprefixer": "^7.0.0",
"gulp-clean-css": "^3.10.0", "gulp-clean-css": "^4.3.0",
"gulp-eslint": "^6.0.0", "gulp-eslint": "^6.0.0",
"gulp-imagemin": "6.0.0", "gulp-imagemin": "6.0.0",
"gulp-sass": "^4.0.2", "gulp-sass": "^4.1.0",
"gulp-uglify": "3.0.2" "gulp-uglify": "3.0.2"
} }
} }