Reputation: 478
I'm trying to compile my templates via grunt nunjucks-2-html:
this is my simplified grunt file:
module.exports = function(grunt) {
grunt.initConfig({
nunjucks: {
options: {
data: {},
paths: '/templates/'
},
render: {
files: [
{
expand: true,
src: '*.html',
cwd: '/templates',
dest: 'build',
ext: '.html'
}
]
}
}
});
grunt.loadNpmTasks('grunt-nunjucks-2-html');
};
my folder structure looks like this:
```
project
│ Gruntfile.js
│
└───templates
│ index.html
│ foo.html
│
└───build
```
When i run grunt nunjucks i got the following error:
"Running "nunjucks:render" (nunjucks) task No files specified." So obviously nunjucks can't find my templates. I have no idea where to config the template path, to me my gruntfile seems valid. If you have any idea, I would be glad.
Thank you!
Upvotes: 0
Views: 267
Reputation: 9690
The __dirname
variable references the directory the Gruntfile lives in.
You could try using paths: __dirname + '/templates/'
or just simply paths: 'templates'
as described in the nunjucks-2-html npm documentation.
Upvotes: 2