Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start a Rails 3 app with HAML and SASS as the default templates?

the line

rails new someapp -m haml

doesn't work. It seems to need a path to some where.

Update: haml-rails is in fact installed by gem install haml-rails but the line above wouldn't work.

like image 912
nonopolarity Avatar asked Sep 03 '10 23:09

nonopolarity


2 Answers

The really short version

Generate a new rails app based on a simple template that sets up Haml out of the box (and some other nice optional features).

rails new ProjectName -m https://raw.github.com/RailsApps/rails3-application-templates/master/rails3-haml-html5-template.rb

http://decielo.com/articles/377/haml-by-default-in-a-new-rails-3-2-app

Also check this out:

https://github.com/RailsApps/rails-composer

EDIT:

If you want to do this through the "gem" you simply need to run the default command

rails new myapp -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb

This is a safe command as it points to the master branch of the gem and will be a stable URL. Once you have run this command you will be prompted with options. Simply select HAML and SASS when asked by the wizard.

like image 154
Abram Avatar answered Nov 18 '22 16:11

Abram


Gem haml-rails allows to generate views in Haml, but not the initial layout.

After running rails new someapp (note: w/o -m haml) and adding line gem "haml-rails" to your Gemfile, you just need to rename application.html.erb to application.html.haml and manually convert its content from ERB to Haml.

After that, all generated views will be in Haml.

like image 5
Andrei Avatar answered Nov 18 '22 18:11

Andrei