@testerum/ejs-compiled-loader-webpack4-nodeps
v0.0.1
Published
Webpack 4+ loader to compile EJS templates. Does not depend on htmlmin, uglify-js, or other packages that may cause issues.
Downloads
6
Readme
ejs-compiled-loader-webpack4-nodeps
Webpack 4+ loader to compile EJS templates.
The loader loads a .ejs
file and returns a compiled template.
Why, oh why, yet another EJS webpack loader?
While there are many EJS webpack loaders, none of the ones I tried were good enough:
- some would render the template at build-time, but I needed template compilation, to be able to render the template at runtime
- some would do template compilation, but 3rd party dependencies like
uglify-js
would cause webpack to break with weird errors
This package does not depend on htmlmin
, uglify-js
, or other packages that may cause issues.
Installation
npm install --save-dev @testerum/ejs-compiled-loader-webpack4-nodeps
Webpack config
Minimum required configuration:
module.exports = {
module: {
rules: [
{
test: /\.ejs$/,
use: "@testerum/ejs-compiled-loader-webpack4-nodeps"
}
]
}
};
It's also possible to pass options to EJS:
module.exports = {
module: {
rules: [
{
test: /\.ejs$/,
use: [
{
loader: "@testerum/ejs-compiled-loader-webpack4-nodeps",
options: {
ejsOptions: {
compileDebug: true
}
}
}
]
}
]
}
};
Everything inside ejsOptions
will be passed to EJS.
Release history
- 0.0.1 - Initial release