This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

underscore-loader

3.0.0 • Public • Published

underscore-loader

Webpack loader for pre-compiled Underscore/Lodash templates with HTML minification

Installation

$ npm install --save underscore-loader lodash.escape

Important!!1

For webpack 1.x.x use version 2.0.0

Options (defaults)

Webpack (2.x.x) config

{
  // ...
 module: {
    rules: [
      {
        test: /\.tpl$/,
        loader: 'underscore-loader',
        options: {
          engine: 'var _ = { escape: require(\'lodash.escape\') };\n',
          minifierOptions: { collapseInlineTagWhitespace: true }
        }
      }
    ]
  }
  // ..
}

engine

  • for full lodash set it to var _ = require(\'lodash\');
  • for full underscore set it to var _ = require(\'underscore\');
  • lodash.escape is default, change it to lodash, underscore or some-other-engine

minify

minifierOptions

originalSource

  • append original html in comment

templateOptions

Setting template engine

  • set underscore/lodash/other-module dependency in package.json
  • if you don't use any logic in your templates, you can pass empty string (engine: '')

Custom module's path examples (old README)

View on github.

Changelog

View on github.

Package Sidebar

Install

npm i underscore-loader

Weekly Downloads

165

Version

3.0.0

License

MIT

Last publish

Collaborators

  • tomekf