Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

EJS loader for webpack (without frontend dependencies)

License

Notifications You must be signed in to change notification settings

Findy/ejs-compiled-loader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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-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

module: {
  rules: [{
    test: /\.ejs$/, 
    use: {
      loader: 'ejs-compiled-loader',
      options: {
        htmlmin: true,
        htmlminOptions: {
          removeComments: true
        }
      }
    }
  }]
}

See all options reference

License

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

About

EJS loader for webpack (without frontend dependencies)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 91.6%
  • EJS 8.4%