【问题标题】:Devise does not load custom CSS设计不加载自定义 CSS
【发布时间】:2012-07-22 07:41:16
【问题描述】:

所以,我们最近开始从定制的身份验证模块更改为设计,我在试图弄清楚如何将我的 css 加载到我的设计视图中时遇到了非常糟糕的时间。我可以正确加载部分,甚至是来自 /layouts/ 的部分,但它一直试图从 /assets/devise 访问 css,达到 404。 这是我的 app/views/registration/new.html.haml,例如:

%h2 Sign up
= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|
  = devise_error_messages!
  %div
    = f.label :email
    %br/
    = f.email_field :email
  %div
    = f.label :password
    %br/
    = f.password_field :password
  %div
    = f.label :password_confirmation
    %br/
    = f.password_field :password_confirmation
  %div= f.submit "Sign up"
= render "users/shared/links"

因此,我们将不胜感激任何帮助。 =)

在快速更新中:我已经运行了 rails g devise:views。 我认为问题在于它没有在资产管道中加载我的 CSS。

【问题讨论】:

    标签: css ruby-on-rails devise haml


    【解决方案1】:

    您应该首先生成设计视图。试试这个:rails generate devise:views。然后您还可以自定义设计视图。

    【讨论】:

    • 我做到了。这个haml位于/app/views/registration/new.html.haml中。
    • 如果 public/assets 存在,删除文件夹。
    猜你喜欢
    • 1970-01-01
    • 2017-12-04
    • 2023-03-29
    • 2014-08-21
    • 1970-01-01
    • 2019-06-22
    • 2019-01-24
    • 2015-08-12
    • 1970-01-01
    相关资源
    最近更新 更多