# ejs2-loader **Repository Path**: mirrors_jaywcjlove/ejs2-loader ## Basic Information - **Project Name**: ejs2-loader - **Description**: EJS loader for webpack - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-10-22 - **Last Updated**: 2025-09-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## Usage ```bash sudo npm install ejs2-loader --save ``` [Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html) ### in js ``` js var template = require("ejs-compiled!./file.ejs"); // => returns the template function compiled with ejs templating engine. // And then use it somewhere in your code // Pass object with data template(data) ``` ### in webpack ```js { module: { loaders: [ {test: /\.ejs$/, loader: 'ejs2-loader?htmlmin=removeComments|removeAttributeQuotes|minifyCSS'} ] } } ``` [HTMLMinifier, Options Quick Reference](https://github.com/kangax/html-minifier#options-quick-reference) ### Child Templates ```html <%- var title = "This is really amazing" -%> <%- include templates/header -%> ``` # reference - [How to write a plugin](https://webpack.github.io/docs/how-to-write-a-plugin.html) - [mde/ejs](https://github.com/mde/ejs)