template-string-loader
ES6 template string loader module for webpack
Last updated 3 years ago by bradbenvenuti .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install template-string-loader 
SYNC missed versions from official npm registry.

template-string-loader

Webpack ES6 Template String Loader

Installation

npm install template-string-loader

Usage

You will need to use this with the babel loader or some other ES6 loader that supports template strings.

var template = require("babel!template-string!./file.html")({data: '123'});

Example template:

<!-- file.html -->
<div>${scope.data}</div>

The loader returns a function like below. Call the function with the data you want to pass to the template. That data is available on the scope param:

module.exports = function(scope){
    return `<div>${scope.data}</div>`;
}

Result:

<div>123</div>

Current Tags

  • 0.0.4                                ...           latest (3 years ago)

4 Versions

  • 0.0.4                                ...           3 years ago
  • 0.0.3                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 3
Dependencies (0)
None
Dev Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |