3.0.0 • Published 7 years ago

underscore-loader v3.0.0

Weekly downloads
548
License
MIT
Repository
github
Last release
7 years ago

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.

3.0.0

7 years ago

2.0.0

7 years ago

1.0.0

7 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago

0.0.0

8 years ago