Trying to integrate gulp-connect with Jekyll -
basically i'd have jekyll project watched , when changes occur browser refreshes reflect them. thinking integrating gulp-jekyll in workflow, , boot server too...
var gulp = require('gulp'); gutil = require('gulp-util'), sass = require('gulp-ruby-sass'), autoprefixer = require('gulp-autoprefixer'), minifycss = require('gulp-minify-css'), uglify = require('gulp-uglify'), concat = require('gulp-concat'), notify = require('gulp-notify'), connect = require('gulp-connect'), exec = require('gulp-exec'), livereload = require('gulp-livereload'), lr = require('tiny-lr'), server = lr(); var jssources = ['source/assets/js/*.js', 'source/assets/lib/*.js']; var sasssources = ['source/assets/sass/style.scss']; gulp.task('styles', function() { return gulp.src(sasssources) .pipe(sass({ style: 'expanded' })) .pipe(autoprefixer('last 29 version')) .pipe(minifycss()) .pipe(gulp.dest('source/stylesheets/vendor/min')) .pipe(connect.reload()) .pipe(livereload()) .pipe(notify({ message: 'by command..."styles" command executed' })) }); gulp.task('js', function() { return gulp.src(jssources) .pipe(uglify()) .pipe(concat('script.js')) .pipe(gulp.dest('source/javascript')) .pipe(connect.reload()) .pipe(livereload()) .pipe(notify({ message: 'by command..."js" command executed' })) });
however right here causing error...see below terminal output.
gulp.task('server', function() { connect(connect.static('_site')).listen(9000); console.log('server running @ http://localhost:9000/'); gulp.watch('source/**', function(event) { console.log(event.path + ' ' + event.type + ', rebuilding...') gulp.src('').pipe(exec("jekyll build && compass compile")).pipe(livereload()); }); }); gulp.task('watch', function() { var server = livereload(); gulp.watch(jssources, ['js']); gulp.watch(['source/**'], ['server']); gulp.watch(['javascript/script.js'], function(e) { server.changed(e.path); }); gulp.watch(sasssources, ['styles']); }); gulp.task('default', ['js', 'styles', 'watch', 'server']);
this error in terminal...
[gulp] starting 'server'... [gulp] 'server' errored after 83 μs object #<object> has no method 'static'
disclaimer know there great yeoman generator exists. , seems want. why torture myself? well, configured of present gulp file myself. , love figure out...
Comments
Post a Comment