O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Instant Haml

Book Description

Learn how to integrate Haml into your current application setup and development workflow

  • Learn something new in an Instant! A short, fast, focused guide delivering immediate results
  • Step-by-step instructions that will help you integrate Haml into your current application setup and development workflow
  • Learn how to speed up development of view templates
  • Understand Haml options, configuration and Rails-specific features

In Detail

Haml is a markup language used to rapidly develop Rails view templates (or HTML pages). It is used by professional developers and praised for its cleanliness, human friendliness and usage agility. It functions as a replacement for inline page templating systems such as PHP, ASP, and ERB - the templating language used in most Ruby on Rails applications. Haml is itself a description of HTML and hence it avoids the need for explicitly coding HTML into the template with some code to generate dynamic content.

A practical guide which shows you a number of examples of Haml usage and then lets you dive into more advanced features to help you take full advantage of rapid development of view templates in your Rails applications. This book will show you how you can use Haml to create beautiful, easily maintainable and concise view templates without the hassle of writing in HTML.

Starting by showing you how to install Haml and how to integrate it into your Rails application, this practical guide will then teach you how to create the elements of a view template. This book will introduce you to the important features of Haml, show you how to integrate Haml with your development editor, and how to make it work with the Twitter Bootstrap framework.

This book will also show you how to convert existing view templates. With this book, you will be able to integrate Haml into your current application setup and development workflow.

Table of Contents

  1. Instant Haml
    1. Instant Haml
    2. Credits
    3. About the Author
    4. About the Reviewer
    5. www.packtpub.com
      1. Support files, eBooks, discount offers and more
    6. packtlib.packtpub.com
      1. Why Subscribe?
      2. Free Access for Packt account holders
    7. 1. Instant Haml
      1. So, what is Haml?
      2. Installation
        1. Step 1 – what do I need?
        2. Step 2 – downloading and installing Haml
        3. Step 3 – converting an Haml file to an HTML file using the command line Haml utility to verify that it works
          1. OSX/Linux
          2. Windows
        4. And that's it
      3. Quick start – using Haml
        1. Step 1 – integrating with Rails and creating a simple view file
        2. Step 2 – switching Rails application to use Haml as the templating engine
        3. Step 3 – converting existing view templates to Haml
        4. Step 4 – using attributes
        5. Step 5 – integrating Haml with your current programming editor
          1. Sublime Text 2
            1. Improved language
            2. Added snippets and commands
          2. TextMate
          3. Vim
          4. Rubymine
          5. Emacs
          6. Coda
        6. Step 6 – Haml and Twitter Bootstrap framework
      4. Top 6 features you'll want to know about
        1. Using HTML tags and attributes
          1. Creating basic tags
          2. Inserting HTML attributes
          3. Using Boolean attributes
          4. Inserting HTML5 data attributes
          5. Appending class and ID names
          6. Self-closing tags
          7. Using object references in class and ID names
        2. Generating doctypes
        3. Adding comments to the markup
          1. Using HTML comments
          2. Using Haml/Ruby comments
        4. Evaluating Ruby code
          1. Inserting Ruby code
          2. Running Ruby code
          3. Using Ruby interpolation
          4. Escaping/unescaping
        5. Using filters
          1. Creating a custom filter
        6. Creating multiline attributes, Ruby code, and strings
          1. Attributes
          2. Ruby code
          3. Strings
        7. Using helpers and the ActionView extensions
        8. Changing Haml options
        9. Using HAML outside of Rails
          1. The tools for standalone HAML development
            1. Hammer
            2. Codekit
            3. LiveReload
            4. StaticMatic, Jekyl, and Middleman
          2. Streamline static site development with Middleman
            1. Exporting static site
      5. People and places you should get to know
        1. Official sites
        2. Articles and tutorials
        3. Community
        4. Twitter