hamljs-loader

0.1.1 • Public • Published

HamlJS Loader for Webpack

Import "static" Haml files as modules in your webpack project. Returns a template function that can be called with your passed-in local attributes.

This is a fork of haml-haml-loader.

Setup

Add to your webpack config module.loaders:

{ test: /\.html\.haml$/, loader: "hamljs" }

Rendering templates

webpack/assets/javascripts/templates/my_template.html.haml

.template
  %h1= title

webpack/assets/javascripts/modules/my_module.js

import Template from "../templates/my_template.html.haml"
 
const title = "My Title"
const template = Template({ title })
 
document.append(template)

will return the HTML:

<div class="template">
  <h1>My Title</h1>
</div>

Readme

Keywords

none

Package Sidebar

Install

npm i hamljs-loader

Weekly Downloads

11

Version

0.1.1

License

MIT

Unpacked Size

3.16 kB

Total Files

4

Last publish

Collaborators

  • tubbo