jsmart-loader
v2.0.0
Published
Use jSmart (PHP Smarty port in JS) in Webpack.
Downloads
804
Maintainers
Readme
jSmart loader for webpack
jSmart loader lets you use jSmart(Smarty template javascript engine) and Webpack together, including auto-loading partials.
Install
npm install jsmart-loader --save-dev
Usage
#### webpack 2.x to webpack 5.x
```javascript
module: {
rules: [ {
test: /\.tpl|\.smarty$/,
loader: 'jsmart-loader'
} ]
}
webpack 1.x
module: {
loaders: [ {
test: /\.tpl|\.smarty$/,
loader: 'jsmart'
} ]
}
var template = require('./template.smarty');
var html = template({ name: 'world' });
If you want to set custom delimiters then you can pass on delimiters one (left or right) or both using options. You can also pass on auto delimiters detection on or off using options.
module: {
rules: [ {
test: /template\.smarty$/,
loader: 'jsmart-loader',
options: {
leftDelim: '{{',
rightDelim: '}}',
autoLiteral: false
},
} ]
}