0

我已经设置了 activeadmin,但我不得不将文件拉出并将它们放入名为“admin”的 assets/stylesheets 和 assets/javascripts 子文件夹中,因为这些样式会继承到我的主应用程序中并导致各种问题。

我按照这里的说明操作:http: //mrdanadams.com/2011/exclude-active-admin-js-css-rails 其中:

Create the folders app/assets/javascripts/admin and app/assets/stylesheets/admin and move the files active_admin.js and active_admin.css.scss into these folders, respectively.

In your app/assets/stylesheets/application.css.scss you will find the following near the top:

 *= require_self
 *= require_true .

Change this to:

 *= require_self
 *= require_directory .

Do the same for application.js.

The culprit is active_admin’s asset_registration.rb and application.rb:

def register_default_assets
register_stylesheet 'active_admin.css'
register_javascript 'active_admin.js'
end

To clear these and replace them with the new files, add the following to the bottom of config/initializers/active_admin.rb:

config.clear_stylesheets!
config.register_stylesheet 'admin/active_admin.css'

config.clear_javascripts!
config.register_javascript 'admin/active_admin.js'

我已按照这些说明进行操作,但现在我的管理员失去了样式/js 功能,看起来我的应用程序仍在尝试拉入这些文件。

寻求帮助使资产正常工作,并将它们排除在我的主应用程序之外。谢谢!

4

0 回答 0