Skip to content

hmpl loader for webpack. Designed to process files with the .hmpl extension

License

Notifications You must be signed in to change notification settings

hmpljs/hmpl-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hmpl-loader

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

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>
  {
    {
      "src":"/api/test"
    }
  }
</div>

main.js

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

const elementObj = templateFn();

Changelog

Changelog

License

Licensed under MIT