carlitoplatanito / gulp-nunjucks-render

[Gulp](https://github.com/wearefractal/gulp) plugin to render [Nunjucks](http://mozilla.github.io/nunjucks/) templates
149 stars 33 forks source link

Template not found. #44

Closed dutraveller closed 6 years ago

dutraveller commented 8 years ago

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

thiagodebastos commented 8 years ago

@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.