EJS ("Embedded JavaScript" templates) loader for webpack. Not more, not less.
It uses the EJS function from mde to compile templates.
npm install embeddedjs-loader
<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>
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
]
}
};