Giter Site home page Giter Site logo

chibisuke / haml-loader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from newrelic-forks/haml-loader

0.0 1.0 0.0 8 KB

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

Home Page: http://npm.im/haml-haml-loader

JavaScript 100.00%

haml-loader's Introduction

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.

Setup

Add to your webpack config module.loaders:

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

Rendering templates

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

.template
  %h1 {{ title }}

webpack/assets/javascripts/modules/my_module.js

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

will return the 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'] },

haml-loader's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.