deviseにhamlのジェネレータがあった

devise のソースを眺めてたら View の ジェネレータで haml も作れそうだったのでやってみた。

確かにあるね。

% rails g devise_views --help
Usage:
  rails generate devise_views [SCOPE] [options]

Options:
  -e, [--template-engine=TEMPLATE_ENGINE]  # Template engine for the views. Available options are 'erb' and 'haml'.
                                           # Default: erb

Runtime options:
  -f, [--force]    # Overwrite files that already exist
  -p, [--pretend]  # Run but do not make any changes
  -q, [--quiet]    # Supress status output
  -s, [--skip]     # Skip files that already exist

Copies all Devise views to your application.

hpricot とruby_parser が入ってなくてエラーが出たんでインストール。

% gem i hpricot ruby_parser

レッツ!

% rails g devise_views -e haml
      create  app/views/devise
      create  app/views/devise/sessions/new.html.haml
      create  app/views/devise/shared/_links.haml
      create  app/views/devise/passwords/edit.html.haml
      create  app/views/devise/passwords/new.html.haml
      create  app/views/devise/unlocks/new.html.haml
      create  app/views/devise/confirmations/new.html.haml
      create  app/views/devise/registrations/edit.html.haml
      create  app/views/devise/registrations/new.html.haml
      create  app/views/devise/mailer/confirmation_instructions.html.haml
      create  app/views/devise/mailer/unlock_instructions.html.haml
      create  app/views/devise/mailer/reset_password_instructions.html.haml

Rails 3 は haml 普通に使えてよいね。