rollup-plugin-dot
v1.1.0
Published
rollup plugin to compile doT files
Downloads
153
Readme
rollup-plugin-dot
rollup plugin to compile doT files.
view.dot
<p>{{= it.message }}</p>
main.js
import view from './view.dot';
let data = { message: 'Hello world' };
console.log(`Render result: ${view(data)}`);
Installation
yarn add -D rollup-plugin-dot
// Or use npm
npm install -D rollup-plugin-dot
Usage
rollup.config.js
import dot from 'rollup-plugin-dot';
export default {
input: 'src/index.js',
output: {
file: 'dist/bundle.js',
format: 'iife',
},
plugins: [
dot({
include: ['**/*.dot', '**/*.tpl'], // default to `**/*.dot`
exclude: ['**/index.tpl'], // default to `undefined`
templateSettings: { strip: false }, // doT template settings, default to doT's default settings
defines: { // doT template defines, default to `undefined`
env: process.env.NODE_ENV || 'development',
},
}),
],
};