# haml-haml-loader

> haml-loader fork; webpack loader using 'haml' instead of 'haml-coffee'

Latest version **1.0.1** (published 2015-06-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install haml-haml-loader
pnpm add haml-haml-loader
yarn add haml-haml-loader
bun add haml-haml-loader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2015-06-05 |
| First published | 2015-06-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Alexander Pavlenko |
| Maintainers | adamdicarlo |

## Links

- npm: https://www.npmjs.com/package/haml-haml-loader
- Repository: https://github.com/newrelic-forks/haml-loader
- Homepage: https://www.npmjs.com/package/haml-haml-loader
- Issues: https://github.com/newrelic-forks/haml-loader/issues
- npm.io page: https://npm.io/package/haml-haml-loader

## Dependencies (2)

- [haml](https://npm.io/package/haml.md) ^0.4.3
- [loader-utils](https://npm.io/package/loader-utils.md) 0.2.x

## Recent versions

- 1.0.1 (latest) — 2015-06-05
- 1.0.0 — 2015-06-05

## README

# Haml Loader for Webpack

Import "static" Haml files as modules in your webpack project. Returns a rendered template.

This is a fork of [Haml-Coffee (Hamlc) Loader for Webpack](https://www.npmjs.com/package/haml-loader).

## Setup

Add to your webpack config module.loaders:

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

## Rendering templates

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

````javascript
.template
  %h1 {{ title }}
````

### webpack/assets/javascripts/modules/my_module.js

````javascript
require("templates/my_template.html.haml")
````

will return the HTML:

````html
<div class="template">
  <h1>{{ title }}</h1>
</div>
````

## Can I embed JavaScript in my Haml?

In *theory* yes, but at the moment it likely isn't wired up right; this is just a way to convert
"static" Haml into HTML in a webpack loader.

## Why the fork?

The `haml-loader` module uses haml-coffee, which doesn't understand Haml syntax as well as the
`haml` module. For instance, for an Angular template, it seems to interpret `%p {{ content }}` as
`%p{{ content }}` -- that is, it pretty much just blows up, (apparently) seeing the first curly
brace as Haml's older attribute specifier syntax.

## AngularJS

`haml-haml-loader` can be nicely chained with `ngtemplate-loader`

````
{ test: /\.html\.haml$/, loaders: ['ngtemplate?relativeTo=assets/javascripts', 'haml-haml'] },
````

---
_Source: https://npm.io/package/haml-haml-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
