ejs-file-loader

1.0.2 • Public • Published

Webpack EJS Template Loader

Build Status

EJS loader for webpack. Uses ejs function to compile templates.

☁️ Installation

npm i -D ejs-file-loader

📋 Example

JavaScript

var template = require("ejs-file-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 -%>

📝 Documentation

Documentation: Using loaders

Following options can be specified in query:

beautify — enable or disable uglify-js beautify of template ast

compileDebug — see ejs compileDebug option

htmlmin — see htmlminify section

htmlminify

module: {
  loaders: [
    {test: /\.ejs$/, loader: 'ejs-file-loader?htmlmin'} // enable here
  ]
},
'ejs-compiled-loader': {
  'htmlmin': true, // or enable here
  'htmlminOptions': {
    removeComments: true
  }
}

See all options reference

📜 License

MIT

Package Sidebar

Install

npm i ejs-file-loader

Weekly Downloads

2

Version

1.0.2

License

MIT

Unpacked Size

4.85 kB

Total Files

4

Last publish

Collaborators

  • pinkahd