carlitoplatanito / gulp-nunjucks-render

[Gulp](https://github.com/wearefractal/gulp) plugin to render [Nunjucks](http://mozilla.github.io/nunjucks/) templates

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Template not found.

dutraveller opened this issue · comments

Hello,
I've adding some errors that i don't understand, because the path is right.

Template render error in plugin 'gulp-nunjucks'
(unknown path)
Error: template not found: layout.njk
gulp file:

nunjucksRender.nunjucks.configure(['_src/templates/']);

// Gets .html and .nunjucks files in pages
return gulp.src('_src/pages/**/*.+(html|nunjucks|njk)')

And the files are there:

_src
--templates
---layout.njk

Thank you

@dutraveller The same thing happened to me when I updated gulp-nunjucks-render from 1.1.10 to 2.0.0. I haven't used nunjucks in a while, perhaps a few things have changed in the config settings? I will look into it and let you know if I figure it out.

EDIT: Check out the changelog:

BC - provide path to templates as path option instead of nunjucks.configure (https://github.com/carlosl/gulp-nunjucks-render#example)

What you will need to do is move the path option from nunjucks.configure:

nunjucksRender.nunjucks.configure(['source/templates/']);

and add it to the config object:

.pipe(nunjucksRender({
  path: ['source/templates/'],
  watch: false,
}))

It works fine after making that quick change.