项目作者: pinkahd

项目描述 :
Webpack EJS Template Loader
高级语言: JavaScript
项目地址: git://github.com/pinkahd/ejs-file-loader.git
创建时间: 2018-02-15T16:17:12Z
项目社区:https://github.com/pinkahd/ejs-file-loader

开源协议:MIT License

下载


Webpack EJS Template Loader

Build Status

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

:cloud: Installation

npm i -D ejs-file-loader

:clipboard: Example

JavaScript

  1. var template = require("ejs-file-loader!./file.ejs");
  2. // => returns the template function compiled with ejs templating engine.
  3. // And then use it somewhere in your code
  4. template(data) // Pass object with data
  5. // Child Templates
  6. // path is relative to where webpack is being run
  7. <%- include templates/child -%>

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

  1. module: {
  2. loaders: [
  3. {test: /\.ejs$/, loader: 'ejs-file-loader?htmlmin'} // enable here
  4. ]
  5. },
  6. 'ejs-compiled-loader': {
  7. 'htmlmin': true, // or enable here
  8. 'htmlminOptions': {
  9. removeComments: true
  10. }
  11. }

See all options reference

:scroll: License

MIT