1.0.0 • Published 8 years ago

embeddedjs-loader v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

embeddedjs-loader for webpack

EJS ("Embedded JavaScript" templates) loader for webpack. Not more, not less.

It uses the EJS function from mde to compile templates.

Installation

npm install embeddedjs-loader

Usage

Documentation: Using loaders

<h1>Hello, I'm a random <%= data.templateType %> template.</h1>
// First, require the file. Either configure embedded-jsloader for .ejs files,
// or use this syntax:
var template = require("embeddedjs!./template.ejs");

// .. then render it:
template({templateType: 'EJS'})
// => '<h1>Hello, I'm a random EJS template.</h1>

Options

Query parameter allow passing options to the compiler.

Configuration example:

module.exports = {
  module: {
    loaders: [
      // .. other loaders
      {
        test: /\.ejs$/,
        loader: "embeddedjs-loader",
        query: {
            // All properties are directly passed to the EJS compiler. For more
            // information on what options are available, check:
            // https://github.com/mde/ejs#options
        }
      },
      // .. other loaders
    ]
  }
};

License

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