rollup-plugin-twig
Rollup plugin that imports pre-compiled Twig.js templates.
Installation
npm install rollup-plugin-twig --save-dev
Usage
Configure Rollup with rollup-plugin-twig
:
Create a template :
{{ foo }}
Import the template and render it with data (optional) :
const data = foo: 'bar' console // <div>bar</div>
Options
Plugin options you can pass :
include
- Minimatch or array of minimatch with files that should be included by default.exclude
- Minimatch or array of minimatch with files that should be excluded by default.minify
- Minify the template (true
by default).
Build
To build the sources with rollup
in ./lib
directory :
npm run build
Testing
To run the tests, first clone the repository and install its dependencies :
git clone https://github.com/fm_ph/rollup-plugin-twig.gitcd rollup-plugin-twignpm install
Then, run the tests :
npm test
To watch (test-driven development) :
npm run test:watch
For coverage :
npm run test:coverage
License
MIT License © Patrick Heng Fabien Motte