New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

hmpl-loader

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hmpl-loader

Loader for files with hpml extension for webpack

latest
Source
npmnpm
Version
0.0.7
Version published
Maintainers
1
Created
Source

hmpl-loader

npm-version

This loader was created for files with the .hmpl extension, which are converted using the hmpl-js package. This loader is designed for webpack.

Loader works with hmpl-js version 1.0.4 or higher

Installation

npm i -D hmpl-loader

Usage:

In the webpack.config.js file you can specify the following lines of code:

module.exports = {
  module: {
    rules: [
      {
        test: /\.hmpl$/i,
        use: ["hmpl-loader"],
      },
    ],
  },
};

After webpack.config.js has been changed, in js files (for example, in main.js), you can import a file with the .hmpl extension and receive a template function in response.

main.hmpl

<div>
  {{#request src="/api/test"}}
  {{/request}}
</div>

main.js

const templateFn = require("./main.hmpl");

const elementObj = templateFn();

Options

The loader supports the compile function options.

module.exports = {
  module: {
    rules: [
      {
        test: /\.hmpl$/i,
        use: {
          loader: "hmpl-loader",
          options: {
            memo: true,
            autoBody: { formData: true },
            allowedContentTypes: ["text/html"],
            disallowedTags: ["script"],
            sanitize: false,
            sanitizeConfig: { USE_PROFILES: { html: true } },
          },
        },
      },
    ],
  },
};

The list of options is described in the documentation here.

Changelog

Changelog

License

Licensed under MIT

Keywords

hmpl

FAQs

Package last updated on 15 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts