Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bazilio91/ejs-compiled-loader
EJS loader for webpack (without frontend dependencies)
https://github.com/bazilio91/ejs-compiled-loader
ejs ejs-loader webpack
Last synced: about 7 hours ago
JSON representation
EJS loader for webpack (without frontend dependencies)
- Host: GitHub
- URL: https://github.com/bazilio91/ejs-compiled-loader
- Owner: bazilio91
- License: mit
- Created: 2014-10-24T10:48:15.000Z (about 10 years ago)
- Default Branch: 3.x
- Last Pushed: 2023-03-04T17:52:11.000Z (almost 2 years ago)
- Last Synced: 2025-01-04T09:49:40.265Z (7 days ago)
- Topics: ejs, ejs-loader, webpack
- Language: JavaScript
- Size: 438 KB
- Stars: 126
- Watchers: 3
- Forks: 73
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-star - ejs-compiled-loader
README
# ejs-compiled-loader for webpack
EJS loader for [webpack](http://webpack.github.io/). Uses [ejs](https://github.com/mde/ejs) function to compile templates.
To use [EJS by tj](https://github.com/tj/ejs) use 1.x branch and 1.x.x versions.
## Installation
`npm install ejs-compiled-loader`
## Usage
[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html)
``` javascript
var 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 data// Child Templates
// path is relative to where webpack is being run
<%- include templates/child -%>
```## Options
Following options can be specified in query:
`beautify` — enable or disable terser beautify of template ast
`compileDebug` — see ejs compileDebug option
`htmlmin` — see [htmlminify section](#htmlminify)
## htmlminify
```javascript
module: {
rules: [{
test: /\.ejs$/,
use: {
loader: 'ejs-compiled-loader',
options: {
htmlmin: true,
htmlminOptions: {
removeComments: true
}
}
}
}]
}
```See [all options reference](https://github.com/kangax/html-minifier#options-quick-reference)
## License
MIT (http://www.opensource.org/licenses/mit-license.php)