ejs-templates-loader
EJS loader module for webpack
Installation
npm install --save ejs-templates-loader
Usage
webpack.config.js
module: rules: test: /\.ejs$/ use: loader: 'ejs-templates-loader' options: {} plugins: filename: 'index.html' template: './index.ejs'
Advanced configuration example
webpack.config.js
module: rules: test: /\.ejs$/ use: loader: 'ejs-templates-loader' options: delimiter: '$' plugins: title: 'title' filename: 'index.html' template: './index.ejs'
index.ejs
<!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 (default:{}
)