Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

ejs-compiled-loader-webpack4

2.2.0 • Public • Published

ejs-compiled-loader for webpack

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

To use EJS by tj use 1.x branch and 1.x.x versions.

Installation

npm install ejs-compiled-loader

Usage

Documentation: Using loaders

var template = require("ejs-compiled!./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 uglify-js beautify of template ast

compileDebug — see ejs compileDebug option

htmlmin — see htmlminify section

htmlminify

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

See all options reference

License

MIT (http://www.opensource.org/licenses/mit-license.php)

Install

npm i ejs-compiled-loader-webpack4

DownloadsWeekly Downloads

250

Version

2.2.0

License

MIT

Unpacked Size

5.58 kB

Total Files

12

Last publish

Collaborators

  • avatar