Created
November 21, 2019 16:58
-
-
Save kdankov/9cccc498cc70aafabbcaaa1e98a49b7c to your computer and use it in GitHub Desktop.
CSS Advanced - Nov 2019 - Gulpfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
let gulp = require("gulp"), | |
autoprefixer = require("gulp-autoprefixer"), | |
exec = require("gulp-exec"), | |
browserSync = require('browser-sync').create(), | |
sass = require('gulp-sass'), | |
cp = require("child_process"); | |
gulp.task("css", function() { | |
return gulp.src( '_assets/css/**/*.css' ) | |
// .pipe( sass().on('error', sass.logError) ) | |
.pipe( autoprefixer() ) | |
.pipe( gulp.dest( './docs/css/' ) ) | |
.pipe( browserSync.stream({ match: '**/*.css' }) ) | |
; | |
}); | |
// Jekyll | |
gulp.task("jekyll", function() { | |
return cp.spawn("bundle", ["exec", "jekyll", "build"], { stdio: "inherit", shell: true }); | |
}); | |
gulp.task("watch", function() { | |
browserSync.init({ | |
server: { | |
baseDir: "./docs/" | |
} | |
}); | |
gulp.watch( '_assets/css/**/*.css', gulp.series('css') ); | |
gulp.watch( | |
[ | |
"./*.html", | |
"./_includes/*.html", | |
"./_layouts/*.html", | |
"./_posts/**/*.*" | |
] | |
).on('change', gulp.series('jekyll', 'css') ); | |
gulp.watch( 'docs/**/*.html' ).on('change', browserSync.reload ); | |
gulp.watch( 'docs/**/*.js' ).on('change', browserSync.reload ); | |
}); | |
gulp.task("deploy", gulp.series('jekyll', 'css')); | |
gulp.task("default", gulp.series('jekyll', 'css', 'watch')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment