Phoenix Template Engine for Haml
Powered by Calliope
Usage
- Add
{:phoenix_haml, "~> 0.2.1"}to your deps inmix.exs. If you generated your app from the Phoenix master branch, add phoenix_haml's master branch to your deps instead.{:phoenix_haml, github: "chrismccord/phoenix_haml"} Add the following to your Phoenix
config/config.exsconfig :phoenix, :template_engines, haml: PhoenixHaml.Engine
- Use the
.html.hamlextensions for your templates.
Optional
Add haml extension to Phoenix live reload in config/dev.exs
config :hello_phoenix, HelloPhoenix.Endpoint,
live_reload: [
patterns: [
~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$},
~r{web/views/.*(ex)$},
~r{web/templates/.*(eex|haml)$}
]
]Generators
Generate Resource
Generates a Phoenix resource similar to mix phoenix.gen.html except it generates
haml templates.
mix phoenix_haml.gen.html User users name:string age:integer
Generate Layout
Generates a haml layout template, replacing the eex version.
mix phoenix_haml.gen.layout