Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iyonaga/ejs-templates-loader
EJS loader module for webpack
https://github.com/iyonaga/ejs-templates-loader
ejs ejs-loader webpack webpack-loader
Last synced: 2 months ago
JSON representation
EJS loader module for webpack
- Host: GitHub
- URL: https://github.com/iyonaga/ejs-templates-loader
- Owner: iyonaga
- License: mit
- Created: 2018-08-31T08:47:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T06:54:25.000Z (almost 2 years ago)
- Last Synced: 2024-09-14T12:50:08.101Z (3 months ago)
- Topics: ejs, ejs-loader, webpack, webpack-loader
- Language: JavaScript
- Homepage:
- Size: 448 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ejs-templates-loader
EJS loader module for webpack## Installation
```shell
npm install --save ejs-templates-loader
```## Usage
### webpack.config.js
```js
module: {
rules: [
{
test: /\.ejs$/,
use: {
loader: 'ejs-templates-loader',
options: {}
}
}
]
},plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: './index.ejs'
})
]
```### Advanced configuration example
#### webpack.config.js
```js
module: {
rules: [
{
test: /\.ejs$/,
use: {
loader: 'ejs-templates-loader',
options: {
delimiter: '$'
}
}
}
]
},plugins: [
new HtmlWebpackPlugin({
title: 'title',
filename: 'index.html',
template: './index.ejs'
})
]
```#### index.ejs
```html
<!DOCTYPE html>
<%= htmlWebpackPlugin.options.title %>
<$- include('./_header', {foo: 'foo'}) $>
<$- include _footer $>
```
## Options
- `delimiter` — Character to use with angle brackets for open/close (default: `"%"`)- `beautify` — Enable/Disable beautification (default: `false`)
- `beautifyOptions` See [js-beautify#options](https://github.com/beautify-web/js-beautify#options) (default: `{}`)