From 2db522042ce9772b7d7b21b6f6c6dda9b703feb6 Mon Sep 17 00:00:00 2001 From: Norserium Date: Sun, 2 Dec 2018 02:18:59 +0300 Subject: [PATCH] Updated dependencies and fixed gulpfile.js to adapt it to gulp 4.0 breaking changes --- gulpfile.js | 33 ++++++++++++++++++--------------- package.json | 6 +++--- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 919fa39..393af90 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -23,7 +23,7 @@ var postcssProcessors = [ autoprefixer( { browsers: ['last 2 versions', 'ie > 10'] } ) ] -gulp.task('sassInline', function(callback) { +gulp.task('sassInline', function() { return gulp.src('src/sass/inline.scss') .pipe( postcss(postcssProcessors, {syntax: scss}) @@ -35,7 +35,7 @@ gulp.task('sassInline', function(callback) { .pipe(gulp.dest('build/css/')); }); -gulp.task('sassEmbedded', function(callback) { +gulp.task('sassEmbedded', function() { return gulp.src('src/sass/embedded.scss') .pipe( postcss(postcssProcessors, {syntax: scss}) @@ -47,11 +47,9 @@ gulp.task('sassEmbedded', function(callback) { .pipe(gulp.dest('build/css/')); }); - - var inlineCss = require('gulp-inline-css'); -gulp.task('inlinecss', ['sassInline', 'nunjucks'], function() { +gulp.task('inlinecss', function() { return gulp.src('build/*.html') .pipe( inlineCss({ @@ -65,9 +63,6 @@ gulp.task('inlinecss', ['sassInline', 'nunjucks'], function() { }); - - - /* ************* TEMPLATING ************* */ @@ -75,7 +70,7 @@ gulp.task('inlinecss', ['sassInline', 'nunjucks'], function() { var nunjucksRender = require('gulp-nunjucks-render'); var data = require('gulp-data'); -gulp.task('nunjucks', ['sassEmbedded'], function() { +gulp.task('nunjucks', function() { return gulp.src('src/emails/*.nunjucks') .pipe( data(function() { @@ -107,20 +102,30 @@ gulp.task('zip', function () { /* ************* - SERVER + SERVER ************* */ var connect = require('gulp-connect'); -gulp.task('connect', function() { +gulp.task('connect', function(done) { connect.server({ port: 8000, root: 'build', // Serve from build directory instead, livereload:true }); + done(); }); +/* ************* + BUILD +************* */ + +gulp.task('build', gulp.series( + gulp.parallel('sassInline', 'sassEmbedded'), 'nunjucks', 'inlinecss' + ) +); + /* ************* WATCH @@ -134,7 +139,7 @@ var filesToWatch = [ ] gulp.task('watch', function() { - gulp.watch(filesToWatch,['nunjucks', 'inlinecss']); + return gulp.watch(filesToWatch, gulp.series('build')); }); @@ -142,6 +147,4 @@ gulp.task('watch', function() { DEFAULT ************* */ -gulp.task('default', ['connect', 'nunjucks', 'inlinecss', 'watch']); - - +gulp.task('default', gulp.parallel('connect', 'build', 'watch')); diff --git a/package.json b/package.json index 5f511cd..d58f2b9 100644 --- a/package.json +++ b/package.json @@ -11,13 +11,13 @@ "main": "gulpfile.js", "devDependencies": { "autoprefixer": "^6.3.6", - "gulp": "^3.9.1", - "gulp-connect": "^3.2.2", + "gulp": "^4.0.0", + "gulp-connect": "^5.6.1", "gulp-data": "^1.2.1", "gulp-inline-css": "^3.1.0", "gulp-nunjucks-render": "^2.0.0", "gulp-postcss": "^6.1.0", - "gulp-sass": "^2.2.0", + "gulp-sass": "^4.0.2", "gulp-util": "^3.0.7", "gulp-zip": "^3.2.0", "postcss-scss": "^0.1.7"