Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
ejs-html-loader
Advanced tools
Webpack loader for rendering plain HTML from EJS template files
Install with npm. Ensure EJS and Webpack are installed as well, as these are peer dependencies.
npm install --save-dev webpack ejs ejs-html-loader
In your Webpack configuration, pass data to your
templates through either an 'options'
object or as query parameters.
module.exports = {
// ...
module: {
rules: [{
test: /\.ejs$/,
loader: 'ejs-html-loader',
options: {
title: 'The Ant: An Introduction',
season: 1,
episode: 9,
production: process.env.ENV === 'production'
}
}]
}
};
Data may also be passed through a resource query. These data take precedence over any options with the same name.
import "./index.ejs?page=home";
All properties passed as loader options will be available to your templates as local variables. In addition, the following EJS options may be set:
context : object
The value of this
in your templates. If specified, its properties will be
available in your templates, e.g. <%= this.somePropery %>
.
delimiter : string='%'
Character used inside of angle brackets marking opening/closing tags.
Defaults to '%'
, as in <%= some.variable %>
.
For example:
{
// ...
options: {
delimiter: '$',
title: 'The Naked Ant',
season: 1,
episode: 12
}
}
The EJS filename
option is set automatically, so you may include partials
relative to your template files. If you want your included files to
automatically recompile in watch mode, be sure to use the following syntax:
<% include some/file %>
Copyright © 2016–2019 Akim McMath. Licensed under the MIT License.
FAQs
Webpack loader for rendering HTML from EJS templates
The npm package ejs-html-loader receives a total of 176 weekly downloads. As such, ejs-html-loader popularity was classified as not popular.
We found that ejs-html-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.