foundation / panini

A super simple flat file generator.
Other
592 stars 104 forks source link

Using panini.refresh — typeError in plugin 'run-sequence(server)' #142

Closed olegfedak closed 6 years ago

olegfedak commented 6 years ago

I have the following issue after using panini.refresh in watch task

Default gulp:

var gulp = require('gulp');
var runSequence = require('run-sequence');

gulp.task('default', function() {
    runSequence(
        'copy',
        'sass',
        'render',
        'server',
        'copy:watch',
        'sass:watch',
        'render:watch'  
    );
});

Server task:

var gulp = require('gulp'); 
var browserSync = require('browser-sync').create(); 

gulp.task('server', ['sass:watch', 'render:watch'],  function() { 
    browserSync.init({ 
        server: { 
            baseDir: "dist" 
        },
        files:['dist/*.html', 'dist/css/*.css', 'dist/img/*.*']
    });
});

Render is my panini task:

var gulp = require('gulp');
var panini = require('panini'); 

gulp.task('render', function() {
  gulp.src('src/pages/**/*.html')
    .pipe(panini({
      root: 'src/pages/',
      layouts: 'src/layouts/',
      partials: 'src/partials/',
      helpers: 'src/helpers/',
      data: 'src/data/'
    }))
    .pipe(gulp.dest('dist'));
});

gulp.task('render:watch', function () {
  gulp.watch(['./src/{layouts,partials,helpers,data}/**/*'], [panini.refresh]);
});

It's okay but when I edit partials and save I get the issue:
TypeError in plugin 'run-sequence(server)'

I have tried to change [panini.refresh] at task name ['render'] and don't get error more. but is no any changes after partials files editing — only after server restart

olegfedak commented 6 years ago

Just a nice day. I resolved that issue. Instead [panini.refresh] I used ['render', panini.refresh]

gakimball commented 6 years ago

Are the changes being properly updated? I would assume you'd need to do [panini.refresh, 'render'], because you want Panini to update itself before the pages re-render.

olegfedak commented 6 years ago

All works well. After yours I get: Error: pass strings or arrays of strings

gakimball commented 6 years ago

Gotcha, glad it's working 👍