Tuesday 14 February 2017

Can you guys look @ my gulp file please? (sass & jekyll)

Hello all!I am not familiar with JS well and I am struggling coming up with optimal gulp task file to compile SASS and refresh changes built by Jekyll.I've browsed the web for a while and here is what I came up with:var gulp = require('gulp'); shell = require('gulp-shell'); sass = require('gulp-sass'), browserSync = require('browser-sync'), autoprefixer = require('gulp-autoprefixer'), notify = require("gulp-notify"); gulp.task('sass', function() { return gulp.src('_sass/styles.sass') .pipe(sass().on("error", notify.onError())) .pipe(autoprefixer(['last 15 versions'])) .pipe(gulp.dest('css')) .pipe(browserSync.reload({stream: true})); }); gulp.task('build', shell.task(['jekyll build --watch'])); gulp.task('serve', function () { browserSync.init({server: {baseDir: '_site/'}}); gulp.watch('_sass/**/*.sass', ['sass']); gulp.watch('_site/**/*.*').on('change', browserSync.reload); }); gulp.task('default', ['sass', 'build', 'serve']); However, its is not working properly sometimes. Would you recommend anything to make this workflow better?Here is a Gist for better code format.

Submitted February 14, 2017 at 12:47PM by serhiicss

No comments:

Post a Comment