juanfran / gulp-jade-inheritance

Gulp plugin to rebuild jade files and other files that have extended or included those files
34 stars 32 forks source link

Files dependant on partials not being updated. #16

Closed kyooriouskoala closed 8 years ago

kyooriouskoala commented 8 years ago

Hi!

I made some changes to a partial file _header but the other files brownies and pie that included this partial file are not being updated. Could you help with this issue, please? Thanks!

File structure:

/app/includes/_header.jade /app/recipes/brownies.jade /app/recipes/pie.jade

Task: jade

gulp.task('jade', function() {
    return gulp.src('app/**/*.jade')

    //only pass unchanged *main* files and *all* the partials 
    .pipe($.changed('dist', {extension: '.html'}))

    //filter out unchanged partials, but it only works when watching 
    .pipe($.if(global.isWatching, $.cached('jade')))

    //find files that depend on the files that have changed 
    .pipe(jadeInheritance({basedir: 'jade'}))

    //filter out partials (folders and files starting with "_" ) 
    .pipe($.filter(function (file) {
        return !/\/_/.test(file.path) && !/^_/.test(file.relative);
    }))

    //process jade templates 
    .pipe($.jade({
        pretty : true
    }))

    //save all the files 
    .pipe(gulp.dest('dist'));
});

gulp.task('setWatch', function() {
    global.isWatching = true;
});

Task: watch

gulp.task('watch', ['setWatch', 'pug', 'connect'], function () {
    gulp.watch([
        'dist/**/*.html',
        'dist/assets/css/**/*.css',
        'dist/assets/js/**/*.js'
    ], function(event) {
        console.log(event);
        return gulp.src(event.path)
            .pipe($.connect.reload());
    });

    gulp.watch('app/**/*.jade', ['jade']);
    gulp.watch('app/assets/scss/**/*.scss', ['sass']);
    gulp.watch('app/assets/js/**/*.js', ['js']);
    gulp.watch('app/assets/images/**/*', ['images']);
});
juanfran commented 8 years ago

sorry for the delay

I think you're jadeInheritance basedir is wrong, it should be app/ instead of jade