From bd8f512b7f0266010b7f23e8ef200537c1a5176a Mon Sep 17 00:00:00 2001 From: Roberto Segura - phproberto Date: Wed, 15 Nov 2017 13:50:53 +0100 Subject: [PATCH 1/2] Avoid copying src to _site --- _config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/_config.yml b/_config.yml index 0257743..e227bb5 100644 --- a/_config.yml +++ b/_config.yml @@ -8,3 +8,4 @@ exclude: - package-lock.json - Gemfile - Gemfile.lock + - src From 2532d6d0df4b218c2c3e887bfab20a03bbe8a737 Mon Sep 17 00:00:00 2001 From: Roberto Segura - phproberto Date: Wed, 15 Nov 2017 13:53:20 +0100 Subject: [PATCH 2/2] gulp fixes/improvements --- gulpfile.js | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 12b351b..008a65c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -6,23 +6,27 @@ const siteRoot = '_site'; const cssFiles = 'src/style.css'; const tailwindConfig = 'tailwind-config.js'; -gulp.task('jekyll', () => { - const jekyll = child.spawn('jekyll', ['serve', - '--watch', - '--incremental', - '--drafts' - ]); +var jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll'; - const jekyllLogger = (buffer) => { - buffer.toString() - .split(/\n/) - .forEach((message) => gutil.log('Jekyll: ' + message)); - }; - - jekyll.stdout.on('data', jekyllLogger); - jekyll.stderr.on('data', jekyllLogger); +/** + * Build the Jekyll Site + */ +gulp.task('jekyll-build', function (done) { + browserSync.notify('Running: $ jekyll build'); + return child.spawn( jekyll , ['build'], {stdio: 'inherit'}) + .on('close', done); }); +/** + * Rebuild Jekyll & do page reload + */ +gulp.task('jekyll-rebuild', ['jekyll-build'], function () { + browserSync.reload(); +}); + +/** + * Compile styles + */ gulp.task('css', function () { const atimport = require('postcss-import'); const postcss = require('gulp-postcss'); @@ -40,10 +44,14 @@ gulp.task('css', function () { cascade: false })) .pipe(cleancss()) + .pipe(gulp.dest('_site/assets/css/')) + .pipe(browserSync.reload({stream:true})) .pipe(gulp.dest('assets/css/')); }); - +/** + * Serve site with browserSync + */ gulp.task('serve', () => { browserSync.init({ files: [siteRoot + '/**'], @@ -54,6 +62,7 @@ gulp.task('serve', () => { }); gulp.watch([cssFiles, tailwindConfig], ['css']); + gulp.watch(['**/*.html', '**/*.yml', '!_site/**/*'], ['jekyll-rebuild']); }); -gulp.task('default', ['css', 'jekyll', 'serve']); \ No newline at end of file +gulp.task('default', ['css', 'serve']);