Skip to content
This repository has been archived by the owner on Jun 26, 2022. It is now read-only.

jaywcjlove/ejs2-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Usage

sudo npm install ejs2-loader --save

Documentation: Using loaders

in js

var template = require("ejs-compiled!./file.ejs");
// => returns the template function compiled with ejs templating engine.

// And then use it somewhere in your code
// Pass object with data
template(data) 

in webpack

{
  module: {
    loaders: [
      {test: /\.ejs$/, loader: 'ejs2-loader?htmlmin=removeComments|removeAttributeQuotes|minifyCSS'}
    ]
  }
}

HTMLMinifier, Options Quick Reference

Child Templates

<!-- Child Templates -->
<!-- path is relative to where webpack is being run -->
<!-- global variable -->
<%- var title = "This is really amazing" -%>
<%- include templates/header -%>

reference

About

EJS loader for webpack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published