Webpack loader for compiling Twig.js templates. This loader will allow you to require Twig.js views to your code.
npm install twig-loader
module.exports={//...module: {loaders: [{test: /\.twig$/,loader: "twig-loader"}]},node: {fs: "empty"// avoids error messages}};{# File: dialog.html.twig #}
<p>{{title}}</p>// File: app.jsvartemplate=require("dialog.html.twig");// => returns pre-compiled template as a function and automatically includes Twig.js to your projectvarhtml=template({title: 'dialog title'});// => Render the view with the given contextWhen 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.
- Downgrade Twig.js back to 0.8.9 because of twigjs/twig.js#440
- Improve watch operation (rebuilding of modules)
- Refactoring so compiler and the loader are in seperate modules
- Add Twig as peer dependency
- Add
embedsupport - Update Twig.js version
- Improve
importsupport (zimmo-be#8) - Rethrow exceptions when they occur during rendering to improve testing
- Add support for import statements (useful for Macro's)
- Correctly resolve dependencies from include/import/extend statements with relative path support: [#3] and [#5]
- CHANGE: No longer add the
.twigfile extension. After upgrading twig-loader, you may need to update your files and add.twigmanually