Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Generate Views for Devise in HAML

This is mine Gemfile

gem 'haml'
group :development do
  gem 'hpricot'
  gem 'ruby_parser'
end

I then executed the following statements in a terminal/command window:

bundle install
rails generate devise:views users -e haml

or

rails generate devise:views users -t = haml

But creating devise views in erb. how to fix this issue?

like image 720
Ch Zeeshan Avatar asked Mar 28 '13 07:03

Ch Zeeshan


3 Answers

I have to do this

rails generate devise:views

gem "html2haml"
bundle install

for file in app/views/devise/**/*.erb; do html2haml -e $file ${file%erb}haml && rm $file; done

and now it is perfect.

Also see the devise wiki

like image 144
Ch Zeeshan Avatar answered Oct 09 '22 18:10

Ch Zeeshan


Even simpler solution.

I have erb2haml installed in the development section of my Gemfile, so I just run:

rails generate devise:views
rake haml:erb2haml
# or
rake haml:replace_erbs # outdated

Done!

like image 22
DogpatchTech Avatar answered Oct 09 '22 18:10

DogpatchTech


Have a quick look here. It gives in details explanation itself from devise documentation

How-To:-Create-Haml-and-Slim-Views

like image 20
Ketan Ghumatkar Avatar answered Oct 09 '22 18:10

Ketan Ghumatkar