I have a project set up like this:
and I'm using gulp-nunjucks-render
for templating. My gulpfile.js
looks like this:
gulp.task('nunjucks', function() {
// Gets .html and .nunjucks files in pages folder
return gulp.src('pages/**/*.+(html|nunjucks)')
// Renders template with nunjucks
.pipe(nunjucksRender({
path: ['templates']
}))
// output file to main folder
.pipe(gulp.dest('./'));
});
It works well, and creates an index.html in my root folder.
However, whenever i want to include a partial from templates/partials/bottomnav.nunjucks
, nothing happens. The index file is created, but the bottomnav html is not included.
I have been following this guide and so my index.nunjucks
looks like this:
<!-- index.nunjucks -->
{% extends "layout.nunjucks" %}
{% block content %}
<h1>This is the index page</h1>
{% include "partials/bottomnav.nunjucks" %}
{% endblock %}
-- but why is the partial not included? Is the path wrong?
Well, it turns out the setup above actually works.