Ch Zeeshan
Ch Zeeshan

Reputation: 1644

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?

Upvotes: 13

Views: 7517

Answers (5)

DogpatchTech
DogpatchTech

Reputation: 468

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!

Upvotes: 37

Adnan Ali
Adnan Ali

Reputation: 2960

its simply erb to haml conversion case. you may use any sort of haml converter. Like this one http://htmltohaml.com/

Upvotes: 0

Ketan Ghumatkar
Ketan Ghumatkar

Reputation: 730

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

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

Upvotes: 2

Dominic
Dominic

Reputation: 106

seems that the option to indicate which template engine to use is missing (version 3.0.0). An issue has been open for this. https://github.com/plataformatec/devise/issues/2455

Upvotes: 0

Ch Zeeshan
Ch Zeeshan

Reputation: 1644

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

Upvotes: 30

Related Questions