{"_id":"@cjser/gulp-nunjucks","name":"@cjser/gulp-nunjucks","dist-tags":{"latest":"6.1.0-cjser.2"},"versions":{"6.1.0-cjser.2":{"name":"@cjser/gulp-nunjucks","version":"6.1.0-cjser.2","description":"Compile/precompile Nunjucks templates","license":"MIT","repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"require":"./dist-cjser/index.cjs","default":"./index.js"},"types":"./index.d.ts","engines":{"node":">=18"},"scripts":{"test":"xo && ava"},"keywords":["gulpplugin","nunjucks","jinja","jinja2","django","template","templating","view","precompile","compile","html","javascript"],"dependencies":{"nunjucks":"^3.2.4","@cjser/gulp-plugin-extras__v0_2_2":"0.2.2-cjser.2"},"devDependencies":{"ava":"^5.3.1","gulp-data":"^1.3.1","p-event":"^6.0.0","vinyl":"^3.0.0","xo":"^0.56.0"},"peerDependencies":{"gulp":">=4"},"peerDependenciesMeta":{"gulp":{"optional":true}},"main":"./dist-cjser/index.cjs","cjser":{"sourceVersion":"6.1.0","cjserVersion":2,"original":{"name":"gulp-nunjucks","version":"6.1.0","exports":"./index.js","repository":"sindresorhus/gulp-nunjucks","dependencies":{"gulp-plugin-extras":"^0.2.2","nunjucks":"^3.2.4"},"files":["index.js","index.d.ts"],"scripts":{"test":"xo && ava"}}},"_id":"@cjser/gulp-nunjucks@6.1.0-cjser.2","gitHead":"a4bef54d7d22d3d9a6b84528457938d84cd65fe7","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-s+bdDMkL8wt/233AzV8VDTqSIMJpmcOOl/jPMmduRQGYyoIt9Eba/ww0CyTE+iwQ6CsmyTcm8mPPNMbCOJNPtw==","shasum":"6c1d8a69073bf1047a3b61290e934cd30a677e67","tarball":"https://registry.npmjs.org/@cjser/gulp-nunjucks/-/gulp-nunjucks-6.1.0-cjser.2.tgz","fileCount":6,"unpackedSize":14284,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGsrLPiLw/pwgP6cyIWjDUhrWmwpRiQ0u6PkKXr/cHbNAiAS+yisxymdOcRqG6JTrR9XyvlBCcBYO30N8cmU7I7szA=="}]},"_npmUser":{"name":"nanahira","email":"nanahira@momobako.com"},"directories":{},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/gulp-nunjucks_6.1.0-cjser.2_1778158405675_0.9929565120198123"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-07T12:53:25.565Z","6.1.0-cjser.2":"2026-05-07T12:53:25.819Z","modified":"2026-05-07T12:53:26.079Z"},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"description":"Compile/precompile Nunjucks templates","keywords":["gulpplugin","nunjucks","jinja","jinja2","django","template","templating","view","precompile","compile","html","javascript"],"repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"license":"MIT","readme":"# gulp-nunjucks\n\n> Compile/precompile [Nunjucks](https://mozilla.github.io/nunjucks/) templates\n\n*Issues with the output should be reported on the Nunjucks [issue tracker](https://github.com/mozilla/nunjucks/issues).*\n\n## Install\n\n```sh\nnpm install --save-dev gulp-nunjucks\n```\n\n## Usage\n\n### Compile\n\n```js\nimport gulp from 'gulp';\nimport {nunjucksCompile} from 'gulp-nunjucks';\n\nexport default () => (\n\tgulp.src('templates/greeting.html')\n\t\t.pipe(nunjucksCompile({name: 'Sindre'}))\n\t\t.pipe(gulp.dest('dist'))\n);\n```\n\nYou can alternatively use [gulp-data](https://github.com/colynb/gulp-data) to inject the data:\n\n```js\nimport gulp from 'gulp';\nimport {nunjucksCompile} from 'gulp-nunjucks';\nimport data from 'gulp-data';\n\nexport default () => (\n\tgulp.src('templates/greeting.html')\n\t\t.pipe(data(() => ({name: 'Sindre'})))\n\t\t.pipe(nunjucksCompile())\n\t\t.pipe(gulp.dest('dist'))\n);\n```\n\n### Precompile\n\n```js\nimport gulp from 'gulp';\nimport {nunjucksPrecompile} from 'gulp-nunjucks';\n\nexport default () => (\n\tgulp.src('templates/greeting.html')\n\t\t.pipe(nunjucksPrecompile())\n\t\t.pipe(gulp.dest('dist'))\n);\n```\n\n## API\n\n### nunjucksCompile(data?, options?)\n\nCompile a template using the provided `data`.\n\n#### data\n\nType: `object`\n\nThe data object used to populate the text.\n\n#### options\n\nType: `object`\n\nOptions will be passed directly to the Nunjucks [Environment constructor](https://mozilla.github.io/nunjucks/api.html#constructor) which will be used to compile templates.\n\n##### options.env\n\nType: `nunjucks.Environment`\\\nDefault: `new nunjucks.Environment()`\n\nThe custom Nunjucks [Environment object](https://mozilla.github.io/nunjucks/api.html#environment) which will be used to compile templates. If supplied, the rest of `options` will be ignored.\n\n##### options.filters\n\nType: `object`\n\nAn object containing [custom filters](https://mozilla.github.io/nunjucks/api.html#custom-filters) that will be passed to Nunjucks, with the filter's name as key and the filter function as value.\n\nAsync filters should be defined as async functions. You cannot use just a promise-returning function.\n\n```js\n{\n\t'shorten': string => string.slice(0, 5),\n\t'round': number => Math.round(number),\n\t'fetch': async url => {\n\t\tconst response = await fetch(url);\n\t\tconst result = await response.text();\n\t\treturn result;\n\t}\n}\n```\n\n##### options.extensions\n\nType: `object`\n\nAn object containing [custom tags/extensions](https://mozilla.github.io/nunjucks/api.html#custom-tags) that will be passed to Nunjucks, with the extension's name as key and the extension instance as value.\n\n```js\n{\n\t'UppercaseExtension': new UppercaseExtension()\n}\n```\n\n### nunjucksPrecompile(options?)\n\nPrecompile a template for rendering dynamically at a later time.\n\nSame options as [`nunjucks.precompile()`](https://mozilla.github.io/nunjucks/api.html#precompile) except for `name`.\n\n#### options\n\nType: `object`\n\n##### name\n\nType: `Function`\\\nDefault: Relative template path\\\nExample: `templates/list.html`\n\nYou can override the default behavior by supplying a function which gets the current [File](https://github.com/gulpjs/vinyl#options) object and is expected to return the name.\n\nExample:\n\n```js\n{\n\tname: file => `template-${file.relative}`\n}\n```\n\n## cjser\n\nThis package is a CommonJS-compatible build generated by cjser for projects that still need `require()` support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.\nOriginal repository: https://github.com/sindresorhus/gulp-nunjucks\n","readmeFilename":"readme.md","_rev":"1-03f927cbbbc55c19da5bf7756ba29c9c"}