# Haml-Templating Before the haml generator runs, all assets should be copied to dist folder, because the path_to_* methods are searching there for assets. ### layouts All `*.html.haml` files will be compiled from the haml generator. A `*.html.haml` file alway has a layout, the default layout can be configured in the `project.yml` and is mostly `layout.haml`. To set a specific layout add `-# ehg layout: layout/layout.webdesign` in the first line of your `*.html.haml` file. ### content_for Use it like described in the (actionview docs)[http://apidock.com/rails/ActionView/Helpers/CaptureHelper/content_for] ```ruby - content_for(:body) This is the body content - #and later in your haml-files: = content_for(:body) ``` If you want to use `content_for` you have to remember that there is no output buffer used by ehg for performance reasons. If you want to access `content_for` blocks in your layout.haml you have todo something like this: ```ruby - body = yield !!! %html{lang: content_for(:language)} %head = content_for :javascripts = content_for :stylesheets %body{class: [body_class, 'loading']} = body ``` ### partials Partials are reusable haml files. Per naming convention they start with a underline. The file `src/views/partials/_stylesheets.haml` can be rendered like: ```ruby = render_partial 'partials/_stylesheets.haml' ``` You can also pass parameters to partials: ```ruby = render_partial 'partials/_stylesheets.haml', {my_variable: 'my content'} ``` Inside `src/views/partials/_stylesheets.haml` you can access the parameter: ```ruby = my_variable ``` ### inline coffee and sass We have made the usage of coffee and sass available to all project parts. Use inline coffee and sass as follow: ```ruby = with_coffee do :plain window.head_conf = screens: [ 300 480 650 768 992 1200 ] ``` For inline sass do: ```ruby = with_sass do :plain body color: green ``` You can also inline javascript and css files from the dist folder: ```ruby = inline_javascript_include_tag 'lib/headjs/dist/1.0.0/head.min.js' /[if lt IE 9] = javascript_include_tag 'https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js' = javascript_include_tag 'https://oss.maxcdn.com/respond/1.4.2/respond.min.js' = inline_stylesheet_link_tag 'lib/bootstrap/dist/css/bootstrap.min.css' = inline_stylesheet_link_tag 'webdesign.css' ``` ### ActionView::Helper You can use nearly all helpers included in (ActionView::Helpers)[http://api.rubyonrails.org/classes/ActionView/Helpers.html]. Note that the path will be resolved to the dist folder, take care that all generators that produce assets run befor the haml generator. If EHG can not resolve a path in the dist folder, it leaves the path as is. So you can use external paths. ```ruby %span = image_tag('my_image.png', alt: 'my image', class: 'my-image') = meta_tag_http 'Content-Type', 'text/html; charset=utf-8' = meta_tag 'description', (content_for(:description) || '') = link_tag 'favicon.ico', 'icon', 'image/x-icon' - content_for :footer_menu_links do %ul %li.link = link_to 'my page', 'my_page.html' ``` # Resources > "[Getting started](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/GETSTARTED.md)" > "[Configuration](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/CONFIGURATION.md)" > "[Generators](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/GENERATORS.md)" >"[Contributing](https://github.com/creative-workflow/easy-html-generator/blob/master/docs/CONTRIBUTING.md)"