sindresorhus / gulp-nunjucks

Precompile Nunjucks templates
MIT License
152 stars 20 forks source link

Update index.js for export nunjucks #40

Closed 625781186 closed 2 years ago

sindresorhus commented 2 years ago

Why?

625781186 commented 2 years ago

image

Custom env .

And not repeat install in main project package.json.

sindresorhus commented 2 years ago

Alright, but it will need docs updates.

binyamin commented 2 years ago

Do we really need to export the entire nunjucks library? From the users' perspectives, it might make more sense to export a function which returns an instance of nunjucks.Environment. I was originally going to suggest this as a fix for #42 (custom tags).

module.exports.createEnvironment = function createEnvironment(searchPaths, options) {
    return new nunjucks.Environment(new nunjucks.FileSystemLoader(searchPaths), options);
}
sindresorhus commented 2 years ago

@binyamin Isn't this already possible with the env option?

sindresorhus commented 2 years ago

Closing this PR for lack of activity.