{"_id":"@antilop/twig-loader","_rev":"1-8493f4ab096056523a2b09da658fd8db","name":"@antilop/twig-loader","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@antilop/twig-loader","version":"1.0.0","description":"Webpack loader for compiling twig.js templates","main":"index.js","scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git+https://github.com/zimmo-be/twig-loader.git"},"author":{"name":"Mathieu Maes @ Zimmo.be"},"license":"MIT","bugs":{"url":"https://github.com/zimmo-be/twig-loader/issues"},"homepage":"https://github.com/zimmo-be/twig-loader#readme","peerDependencies":{"twig":"~1.10.5"},"dependencies":{"async":"^2.1.5","hasha":"^3.0.0","loader-utils":"^1.1.0","schema-utils":"^0.4.5","twig":"^1.12.0","underscore":"^1.9.1"},"devDependencies":{"mocha":"^5.2.0","should":"^13.2.1","minimist":">=0.2.1"},"licenseText":"The MIT License (MIT)\n\nCopyright (c) 2015 Zimmo.be\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n","_id":"@antilop/twig-loader@1.0.0","dist":{"shasum":"d98a1781ef7cd55ce9ea12c834cf6b4c3221c157","integrity":"sha512-hhEwbjmvmm1YqeMM0oAD/7a2KPNhZSli4smVW7BEaZ/ag+lh6avtSs+sWW/UrUeIcTWjhMk4XNGexTRAXt9ONw==","tarball":"https://registry.npmjs.org/@antilop/twig-loader/-/twig-loader-1.0.0.tgz","fileCount":52,"unpackedSize":28174,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg8CreCRA9TVsSAnZWagAAnp8P/ioZbTPx9tAOTb2a3eTg\nq9HSvz4C2Z5bxmBcs2CxLuQPQvjXBbArzb+9bJyhdLMVuIylWMWZ9L6tktVj\nR98urSAGCNpZb28DQBK6RsnSUrUcSEpeAmzQmdVrlaDi4zmEIjDlsvzxZL2W\ns0/+OmwtEub/4HzTrgTPOnAndpgU54HsXAkeCpJiV6UETdC/yHXxwbK6yaHG\nzTBZb/yM8vyQDatWw2BVwn0LOIGoihQPXX+aOiMvqnQ0X8uadjd42gTptA3o\n/39EqpH2riw/+GbltxREAm/8RnPYrFspli25J8M8nh1BpcTPXJ99eHkhy7vr\nPoMZzPbLHNLX4/aOpHvRDPxnk4lIGEoCxomEhRii7RPYnKmfVbG+Ngx9qsqc\nAcW4SPKCz3DFXSU06/WrGP0l/yoLhHnFLTuJs9xBMHrgGF/zGmPcSR28i9rY\n9uK0S84yOUt94ImeHmXATP3tL1/WlUcVI2OS0XAq6SNS8SqDXI0lepwwkYcU\nu7MO8GfpsGR5nV9dmXPBzty5jqR6wf4UltBW9zKURVv1XPNfWbFI+Bv57Ahq\n79NXQtIh8YbO/jFgyjyVB8I41ajlawZMxprZ7s6XrfAn9Y91rm3iZMsxpUeV\nTEpt0+z2/TUyzjIqanDqfoxQhDbo0Uact6mqipNPKbJtdqOsCAwPCxO2525q\nMqy1\r\n=sL3P\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFedkjNTguZFSO7XSnmgvkN7W2qTjn8Tebb9YjWEURKjAiEApSwydJ0ofT5OjzFw6Fg1bQW4WLyGWpsE/xzostFOibs="}]},"_npmUser":{"name":"gbelorgey","email":"gregoire@antilop.fr"},"directories":{},"maintainers":[{"name":"gbelorgey","email":"gregoire@antilop.fr"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/twig-loader_1.0.0_1626352350805_0.24457289093138046"},"_hasShrinkwrap":false}},"time":{"created":"2021-07-15T12:32:30.699Z","1.0.0":"2021-07-15T12:32:30.960Z","modified":"2022-04-04T14:22:21.109Z"},"maintainers":[{"name":"gbelorgey","email":"gregoire@antilop.fr"}],"description":"Webpack loader for compiling twig.js templates","homepage":"https://github.com/zimmo-be/twig-loader#readme","repository":{"type":"git","url":"git+https://github.com/zimmo-be/twig-loader.git"},"author":{"name":"Mathieu Maes @ Zimmo.be"},"bugs":{"url":"https://github.com/zimmo-be/twig-loader/issues"},"license":"MIT","readme":"# twig-loader [![Build Status](https://travis-ci.org/zimmo-be/twig-loader.svg)](https://travis-ci.org/zimmo-be/twig-loader)\nWebpack loader for compiling Twig.js templates. This loader will allow you to require Twig.js views to your code.\n\n## Installation\n\n`npm install twig-loader`\n\n## Usage\n\n### Webpack 2 and later\n\n[Documentation: Using loaders](https://webpack.js.org/concepts/loaders/)\n\n``` javascript\nmodule.exports = {\n  //...\n\n  module: {\n    rules: [\n      {\n        test: /\\.twig$/,\n        use: {\n          loader: 'twig-loader',\n          options: {\n              // See options section below\n          },\n        }\n      }\n    ]\n  },\n\n  node: {\n      fs: \"empty\" // avoids error messages\n  }\n};\n```\n\n### Webpack 1\n\n[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html?branch=master)\n\n``` javascript\n\nmodule.exports = {\n    //...\n\n    module: {\n        rules: [\n            {\n                test: /\\.twig$/,\n                loader: \"twig-loader\",\n                options: {\n                    // See options section below\n                },\n            }\n        ]\n    },\n\n    node: {\n        fs: \"empty\" // avoids error messages\n    }\n};\n```\n\n\n\n### Options\n\n- `twigOptions`: optional; a map of options to be passed through to Twig.\n  Example: `{autoescape: true}`\n\n## Loading templates\n\n```twig\n{# File: dialog.html.twig #}\n<p>{{title}}</p>\n```\n\n```javascript\n// File: app.js\nvar template = require(\"dialog.html.twig\");\n// => returns pre-compiled template as a function and automatically includes Twig.js to your project\n\nvar html = template({title: 'dialog title'});\n// => Render the view with the given context\n\n```\n\nWhen you extend another view, it will also be added as a dependency. All twig functions that refer to additional templates are supported: import, include, extends & embed.\n\n\n## Dynamic templates and registering at runtime\n\ntwig-loader will only resolve static paths in your templates, according to your webpack configuration.\nWhen you want to use dynamic templates or aliases, they cannot be resolved by webpack, and will be\nleft untouched in your template. It is up to you to make sure those templates are available in Twig\nat runtime by registering them yourself:\n\n``` javascript\nvar twig = require('twig').twig\ntwig({\n  id: 'your-custom-template-id,\n  data: '<p>your template here</p>',\n  allowInlineIncludes: true,\n  rethrow: true\n});\n```\n\nOr more advanced when using `webpack.context`:\n``` javascript\nvar twig = require('twig').twig\n\nvar context = require.context('./templates/', true, /\\.twig$/)\ncontext.keys().forEach(key => {\n  var template = context(key);\n  twig({\n    id: key, // key will be relative from `./templates/`\n    data: template.tokens, // tokens are exported on the template function\n    allowInlineIncludes: true,\n    rethrow: true\n  });\n});\n\n```\n\n\n\n## Changelog\n0.4.1 / 2018-06-12\n==================\n * Upgrade mocha to fix security vulnerability warning\n\n0.4.0 / 2018-05-17\n==================\n * Add ablity to pass options to twig (PR #39)\n\n0.3.1 / 2017-11-08\n==================\n * Update to Twig.js 1.10, fixes #29\n\n0.3.0 / 2017-02-19\n==================\n * replace full path with a hash and implement mapcache for id/path resolution, fixes #12\n\n0.2.4 / 2016-12-29\n==================\n * Downgrade Twig.js back to 0.8.9 because of https://github.com/twigjs/twig.js/issues/440\n\n0.2.3 / 2016-06-11\n==================\n * Improve watch operation (rebuilding of modules)\n * Refactoring so compiler and the loader are in seperate modules\n * Add Twig as peer dependency\n\n0.2.2 / 2016-06-03\n==================\n\n * Add `embed` support\n * Update Twig.js version\n\n0.2.1 / 2016-04-18\n==================\n\n* Improve `import` support (https://github.com/zimmo-be/twig-loader/pull/8)\n* Rethrow exceptions when they occur during rendering to improve testing\n\n0.2.0 / 2016-01-21\n==================\n\n* Add support for import statements (useful for Macro's)\n* Correctly resolve dependencies from include/import/extend statements with relative path support: [\\#3] and [\\#5]\n* CHANGE: No longer add the `.twig` file extension. After upgrading twig-loader, you may need to update your files and add `.twig` manually\n\n","readmeFilename":"README.md"}