Giter Club home page Giter Club logo

haml-rails's Introduction

Haml-rails

Haml-rails provides Haml generators for Rails 4. It also enables Haml as the templating engine for you, so you don't have to screw around in your own application.rb when your Gemfile already clearly indicated what templating engine you have installed. Hurrah.

To use it, add this line to your Gemfile:

gem "haml-rails", "~> 0.9"

This ensures that:

  • Any time you generate a resource, view, or mailer, you'll get Haml templates (instead of ERB)
  • When your Rails application loads, Haml will be loaded and initialized automatically
  • Haml templates will be respected by the view template cache digestor

Pretty fancy, eh? The modern world is just so amazing.

Converting Rails application layout file to haml format

Once Haml-rails is installed on the Rails application, you can convert the erb layout file, app/views/layouts/application.html.erb to app/views/layouts/application.html.haml using this command:

$ rails generate haml:application_layout convert

After the application layout file is converted successfully, make sure to delete app/views/layouts/application.html.erb, so Rails can start using app/views/layouts/application.html.haml instead.

Converting all .erb views to haml format

If you want to convert all of your .erb views into .haml, you can do so using the following command:

$ rake haml:erb2haml

If you already have .haml files for one or more of the .erb files, the rake task will give you the option of either replacing these .haml files or leaving them in place.

Once the task is complete, you will have the option of deleting the original .erb files. Unless you are under version control, it is recommended that you decline this option.

Older versions of Rails

The current version of Haml-rails requires 4.0.1 or later.

Haml-rails version 0.4 is the last version to support Rails 3. To use it, add this line to your Gemfile:

gem "haml-rails", "~> 0.4.0"

Contributors

Haml generators originally from rails3-generators, and written by José Valim, André Arko, Paul Barry, Anuj Dutta, Louis T, and Chris Rhoden. Tests originally written by Louis T.

Code Status

Build Status

License

Ruby license or MIT license, take your pick.

haml-rails's People

Contributors

indirect avatar mfung avatar amatsuda avatar jparker avatar cschramm avatar snoozer05 avatar petergoldstein avatar colindean avatar apux avatar rfichoke avatar itzki avatar slbug avatar essh avatar hanachin avatar tricknotes avatar rrooding avatar neersighted avatar mikdiet avatar hmk avatar sedx avatar hc5duke avatar eprothro avatar carols10cents avatar calebhearth avatar vizjerai avatar beautyfree avatar alanjcfs 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.