Skip to content

umakantp/jsmart-loader

Repository files navigation

jSmart loader for webpack

jSmart loader lets you use jSmart(Smarty template javascript engine) and Webpack together, including auto-loading partials.

Build Status npm version David David npm

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
    },
  } ]
}

Documentation: Using loaders.