一覧へ戻る
fm-ph/rollup-plugin-twig(新しいタブで開きます)
主要言語: JavaScript
📃 Rollup plugin that imports pre-compiled Twig.js templates
- star 数
- 2
- watcher 数
- 2
- fork 数
- 0
- issue 数
- 2
- 最終更新
- 2017/04/19
主要言語: JavaScript
📃 Rollup plugin that imports pre-compiled Twig.js templates
Rollup plugin that imports pre-compiled Twig.js templates.
npm install rollup-plugin-twig --save-dev
Configure Rollup with rollup-plugin-twig :
import { rollup } from 'rollup' import twig from 'rollup-plugin-twig' rollup({ entry: 'src/main.js', plugins: [ twig() ] }).then(...)
Create a template :
<div>{{ foo }}</div>
Import the template and render it with data (optional) :
import template from './template.twig' const data = { foo: 'bar' } console.log(template.render(data)) // <div>bar</div>
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).To build the sources with rollup in ./lib directory :
npm run build
To run the tests, first clone the repository and install its dependencies :
git clone https://github.com/fm_ph/rollup-plugin-twig.git
cd rollup-plugin-twig
npm installThen, run the tests :
npm testTo watch (test-driven development) :
npm run test:watch
For coverage :
npm run test:coverage
MIT License © Patrick Heng Fabien Motte