A
A
Adzhetygenov2017-04-07 18:55:25
JavaScript
Adzhetygenov, 2017-04-07 18:55:25

Compiling modified Pug.js files?

Good day, toasters.
I use html template engine - pug.js in conjunction with gulp. Wrote a task

gulp.task("compile:views", function() {
  return gulp.src('source/pug/*.pug')
    .pipe($.plumber())
    .pipe($.pug({
      pretty: true
    }))
    .pipe(gulp.dest('build/'))
    .pipe($.notify( { title: 'Compile:views' , message: 'Compile:views task completed'} ))
});

There are a couple of files article.pug and index.pug, they include _header.pug. How do I make sure that when any partial component changes, files that include this _header. Gulp-remember, gulp-changed, gulp-cached don't work. Or I have crooked hands. Please help, I'll start spitting soon. I've been sitting for 3 days, I can't implement what seems to be an easy task.
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
alvvi, 2017-04-07
@alvvi

No plugin is needed, we use the standard gulp watcher. On the Gulp4 syntax it will look like this: For Gulp3:
gulp.watch('app/**/*.pug', ['pug']);

O
Oleg, 2017-04-07
@werty1001

You can try this module , I also have similar functionality implemented in my assembly (only if you like BEM).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question