4.0.0 • Published 1 year ago
@myrotvorets/ejs-compiled-loader v4.0.0
ejs-compiled-loader for webpack
EJS loader for webpack. Uses ejs function to compile templates.
This is the fork of the now abandoned bazilio91/ejs-compiled-loader with updated dependencies, fixed vulnerabilities, and updated code base.
The main differences are:
- uses
ejs@3.xinstead of 2.x becauseejsup to 3.1.9 has multiple vulnerabilities (CVE-2022-29078, CVE-2024-33883); - uses
html-minifier-terserinstead of the abandonedhtml-minifier(which is affected by a ReDoS vulnerability). Some options ofhtml-minifier-terserdiffers from those ofhtml-minifier; - does not suppoprt Webpack 4.x.
Installation
npm install -D @myrotvorets/ejs-compiled-loaderUsage
const 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 dataOptions
The following options are supported:
beautify: enable or disable terser beautify of the template AST;compileDebug: see the EJScompileDebugoption;htmlmin: whether to enable HTML minification;htmlminOptions: options passed tohtml-minifier-terser;minimize: whether to minimize the resulting JS code with Terser;terserOptions: options passed toterser;- options supported by EJS.
License
4.0.0
1 year ago