Skip to content

Latest commit

 

History

History
59 lines (44 loc) · 859 Bytes

readme.md

File metadata and controls

59 lines (44 loc) · 859 Bytes

juicer-loader

A webpack loader to pre-build juicer.

Usage

1、 Install juicer-loader

npm install juicer-loader --save-dev

2、Write juicer filename hello.juicer.html

<div>
	My name is $${name}
	{@each list as item,k}
		<div>${item.name},${k}</div>
	{@/each}
</div>

3、Include your juicer file in js

var tpl = require('./hello.juicer.html');
console.log(tpl({
	name: '<div>伯方</div>',
	list:[
		{name:1},
		{name:'bf'}
	]
}));

4、Add loader into your webpack.config.js:

module.exports = {
	entry: './src/index.js',
	output: {
		filename: 'build/bundle.js'
	},
	module: {
		loaders: [{
			test: /\.juicer.html$/,
			loader: 'juicer-loader'
		}]
	}
};

reference

gulp-juicer2js