问题描述
首先,我创建了一个active_admin css文件,作为 app / assets / stylesheets / active_admin.css.scss
First I have created an active_admin css file as app/assets/stylesheets/active_admin.css.scss
/* active_admin.css.scss */
@import "active_admin/mixins";
@import "active_admin/base";
/* application.css.scss*/
@import "active_admin.css.scss"
因此,我有很多CSS被覆盖,我遵循,但仍然无法正常运行。
我将文件位置从 app / assets / stylesheets / active_admin.css.scss
更改为
供应商/资产/样式表/ active_admin.css.scss
,但仍然有问题。
So I have a lot of css of mine been overriden, I followed instructions of this post but still doesn't work.I changed files location from app/assets/stylesheets/active_admin.css.scss
tovendor/assets/stylesheets/active_admin.css.scss
but still having the problem.
那么,如何仅在需要时加载activeadmin css文件?
So, how can I load activeadmin css files only when needed?
推荐答案
为使active_admin发挥出色,请不要将其包含在application.css中,即:删除
For active_admin to play nice don't include it in the application.css, i.e.: remove the
require_tree .
,并分别在应用程序/资产/样式表
中要求每个文件,但不要放置active_admin .css
and require each file separately inside app/assets/stylesheetsbut don't put active_admin.css
并放在config / production.rb上
and on config/production.rb put this
config.assets.precompile += ['active_admin.css']
这篇关于我的css文件由于activeadmin而被覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!