ejs-compiled-loader

EJS webpack loader (without frontend dependencies)

MIT 15 个版本
安装
npm install ejs-compiled-loader
yarn add ejs-compiled-loader
pnpm add ejs-compiled-loader
bun add ejs-compiled-loader
README

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)

版本列表
3.1.0 2021-05-09
3.0.2 2021-05-09
3.0.0 2020-05-13
2.2.0 2016-10-14
2.1.1 2016-02-10
2.1.0 2016-02-01
2.0.4 2015-10-07
2.0.3 2015-10-07
2.0.2 2015-06-15
2.0.1 2015-05-12
2.0.0 2015-05-12
1.1.0 2016-10-14
1.0.0 2015-05-12
0.2.0 2015-03-19
0.1.0 2014-10-24