[英]Rails 4.2.3 Devise setup with Controller-specific Assets
I am using the Controller-specific Assets configuration , it woks perfectly except with the newly installed [Rails-Devise] authentication bundle ( https://github.com/plataformatec/devise ). 我正在使用特定于控制器的Assets配置 ,除了新安装的[Rails-Devise]身份验证捆绑包( https://github.com/plataformatec/devise )之外,它都能正常运行。
For instance on registration page (controller devise/registrations), The assets on /stylesheets/devise/registrations.css
and /javascripts/devise/registrations.js
are not loaded (404). 例如,在注册页面 (控制器设计/注册)上,/
/stylesheets/devise/registrations.css
/ /javascripts/devise/registrations.js
/ registrations.css和/javascripts/devise/registrations.js
上的资产未加载(404)。
Devise works fine when I reactivate both the 当我同时激活两个
application.js 的application.js
//= require_tree .
and 和
application.css application.css
*= require_tree .
but : Is it possible to add devise gem's assets in a way that allows to keep the controller specific assets ? 但是:是否可以以允许保留控制器特定资产的方式添加devise gem的资产?
Thanks, 谢谢,
Devise doesn't have any stylesheet or javascript assets . Devise没有任何样式表或JavaScript资源 。
-- -
You'll be best using some conditional logic in your layout, to determine whether you're using a devise_controller
or not: 最好在布局中使用一些条件逻辑来确定是否使用
devise_controller
:
#app/views/layouts/application.html.erb
stylesheet_link_tag :application, (controller_name unless devise_controller?)
This uses the devise_controller?
这使用
devise_controller?
helper 帮手
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.