# @kontent-market/tpl-loader

> Underscore HTML Templates loader for webpack

Latest version **1.0.2** (published 2021-11-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @kontent-market/tpl-loader
pnpm add @kontent-market/tpl-loader
yarn add @kontent-market/tpl-loader
bun add @kontent-market/tpl-loader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-11-12 |
| First published | 2021-11-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jan Nicklas |
| Maintainers | walendemar, spitfire1236 |
| Keywords | ejs, underscrore, lodash, _, webpack, loader, template |

## Links

- npm: https://www.npmjs.com/package/@kontent-market/tpl-loader
- Repository: git@github.com:spitfire77/km-front
- npm.io page: https://npm.io/package/@kontent-market/tpl-loader

## Dependencies (2)

- [html-loader](https://npm.io/package/html-loader.md) ^0.4.0
- [loader-utils](https://npm.io/package/loader-utils.md) ^0.2.12

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2021-11-12
- 1.0.0 — 2021-11-12
- 1.0.1 — 2021-11-12

## README

# Introduction

This is a modified package, the original is https://github.com/jantimon/html-tpl-loader.git

# Lodash html template for webpack

[![Build Status](https://secure.travis-ci.org/jantimon/html-tpl-loader.svg?branch=master)](http://travis-ci.org/jantimon/html-tpl-loader) [![Dependency Status](https://david-dm.org/jantimon/html-tpl-loader.svg)](https://david-dm.org/jantimon/html-tpl-loader)

Combination of the html-loader and the underscore-loader for [webpack](http://webpack.github.io/). [Uses the `_.template` function](https://lodash.com/docs#template) to extract assets.

## Installation

`npm install @kontent-market/tpl-loader --save-dev`

## Usage

[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html)

```javascript
var template = require('tpl!./file.html');
// => returns the template function compiled with underscore (lodash) templating engine.

// And then use it somewhere in your code
template(data); // Pass object with data
```

Alternatively you can also define html-tpl in your webpack.config file:

```javascript
{
    module: {
        loaders: [{ test: '.tpl.html$', loader: 'tpl' }];
    }
}
```

```javascript
var template = require('./file.tpl.html');
```

The html-tpl loader allows you to **minify** the html before compiling by setting a loader query string

```javascript
  {
    module: {
      loaders: [
        { test: "\.tpl.html$", loader: "tpl?minimize=true" }
      ]
  }

```

The html-tpl loader allows you to not to add **lodash** before compiling by setting a loader query string

```javascript
  {
    module: {
      loaders: [
        { test: "\.tpl.html$", loader: "tpl?lodash=false" }
      ]
  }
```

The html-tpl loader allows you to configure **lodash template settings** by setting a loader query string

```javascript
  {
    module: {
      loaders: [
        { test: "\.tpl.html$", loader: "tpl?evaluate=\\{\\[([\\s\\S]+?)\\]\\}&interpolate=\\{\\{([\\s\\S]+?)\\}\\}" }
      ]
  }
```

## Tests

[![Build Status](https://secure.travis-ci.org/jantimon/html-tpl-loader.svg?branch=master)](http://travis-ci.org/jantimon/html-tpl-loader)

Run unit tests:

```
  npm install
  npm test
```

## Demo

http://jantimon.github.io/html-tpl-loader/

## License

MIT (http://www.opensource.org/licenses/mit-license.php)

---
_Source: https://npm.io/package/@kontent-market/tpl-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
