npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ejs-html-loader

v4.0.1

Published

Webpack loader for rendering HTML from EJS templates

Downloads

1,330

Readme

ejs-html-loader

Version Build Coverage

Webpack loader for rendering plain HTML from EJS template files

Install

Install with npm. Ensure EJS and Webpack are installed as well, as these are peer dependencies.

npm install --save-dev webpack ejs ejs-html-loader

Usage

In your Webpack configuration, pass data to your templates through either an 'options' object or as query parameters.

module.exports = {
  // ...
  module: {
    rules: [{
      test: /\.ejs$/,
      loader: 'ejs-html-loader',
      options: {
        title: 'The Ant: An Introduction',
        season: 1,
        episode: 9,
        production: process.env.ENV === 'production'
      }
    }]
  }
};

Data may also be passed through a resource query. These data take precedence over any options with the same name.

import "./index.ejs?page=home";

Options

All properties passed as loader options will be available to your templates as local variables. In addition, the following EJS options may be set:

  • context : object The value of this in your templates. If specified, its properties will be available in your templates, e.g. <%= this.somePropery %>.

  • delimiter : string='%' Character used inside of angle brackets marking opening/closing tags. Defaults to '%', as in <%= some.variable %>.

For example:

{
  // ...
  options: {
    delimiter: '$',
    title: 'The Naked Ant',
    season: 1,
    episode: 12
  }
}

Includes

The EJS filename option is set automatically, so you may include partials relative to your template files. If you want your included files to automatically recompile in watch mode, be sure to use the following syntax:

<% include some/file %>

License

Copyright © 2016–2019 Akim McMath. Licensed under the MIT License.