11ty-website
11ty-website copied to clipboard
Nunjucks own environment watching
While I realise that the example given in the docs for passing in your own instance of a Nunjucks Environment is purely illustrational, I spotted it as the solution for trimming down my {% include long/path/goes/here.html %}
paths.
What I didn't realise (until I delved into the very sensibly linked docs) is that any changes to files in this path are not reflected when Eleventy spots a change unless the optional watch
property is set to true.
Might I suggest a small change?
let env = process.env.ELEVENTY_ENV;
let nunjucksEnvironment = new Nunjucks.Environment(
new Nunjucks.FileSystemLoader("_includes", {
watch: env == "development"
})
);
Happy to submit a pull request if this might be a good idea.