T
T
Think With Your Head2015-11-06 18:29:11
Pug
Think With Your Head, 2015-11-06 18:29:11

Why does gulp jade compile include files as separate html files?

Hello!
The documentation does not mention this, they say, you just write
include includes/head.jade in index.jade
And you get one compiled html file.
But for me, include/head.jade is compiled along with the folder in include/head.html, although I don’t need it, because this should be part of index.html and not a separate file
I'm using gulp-jade

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Homsa Toft, 2016-01-07
@Vyad

I apologize for the archeology, but it seems to be canonical to do this:

gulp.task('jade', function () {
  return gulp.src(['src/jade/**/*.jade','!src/jade/**/_*.jade'])
    .pipe(newer('src/jade/**/*.jade'))
    .pipe(plumber())
    .pipe(jade({
      pretty: '\t'
    }))
    .on('error', console.log)
    .pipe(gulp.dest('./dist/'));
});

Where, respectively, all your includes are named with a prefix: _head.jade _header.jade _menu.jade _footer.jade

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question