EJS loader for webpack (without frontend dependencies)
MIT License
EJS loader for webpack. Uses ejs function to compile templates.
To use EJS by tj use 1.x branch and 1.x.x versions.
npm install ejs-compiled-loader
var template = require("ejs-compiled-loader!./file.ejs");
// => returns the template function compiled with ejs templating engine.
// And then use it somewhere in your code
template(data) // Pass object with data
// Child Templates
// path is relative to where webpack is being run
<%- include templates/child -%>
Following options can be specified in query:
beautify
— enable or disable terser beautify of template ast
compileDebug
— see ejs compileDebug option
htmlmin
— see htmlminify section
module: {
rules: [{
test: /\.ejs$/,
use: {
loader: 'ejs-compiled-loader',
options: {
htmlmin: true,
htmlminOptions: {
removeComments: true
}
}
}
}]
}