【问题标题】:How do I actually change variables and override styles in ActiveAdmin?如何在 ActiveAdmin 中实际更改变量和覆盖样式?
【发布时间】:2013-12-13 20:37:37
【问题描述】:

我偶然发现了这个:https://github.com/gregbell/active_admin/blob/master/app/assets/stylesheets/active_admin/mixins/_variables.css.scss

在由 ActiveAdmin 生成到 app/assets/stylesheetshttps://github.com/gregbell/active_admin/blob/master/lib/generators/active_admin/assets/templates/active_admin.css.scss 中,我可以看到 $sidebar-width: 242px; 的变化并且它会做出反应,但是如果我尝试从 https://github.com/gregbell/active_admin/blob/master/app/assets/stylesheets/active_admin/mixins/_variables.css.scss 添加任何其他变量,它只会忽略这些变量的变化。例如,下面的代码不会使 bg 颜色变黑...

// SASS variable overrides must be declared before loading up Active Admin's styles.
//
// To view the variables that Active Admin provides, take a look at
// `app/assets/stylesheets/active_admin/mixins/_variables.css.scss` in the
// Active Admin source.
//
// For example, to change the sidebar width:
$sidebar-width: 500px; // works
$body-background-color: #000; // doesn't work

我真的不知道该怎么办。提前致谢。

【问题讨论】:

    标签: ruby-on-rails sass asset-pipeline activeadmin


    【解决方案1】:

    https://github.com/gregbell/active_admin/commit/82402529125764229f5bb851d7b9073ad78eb536 添加了使用 SASS 的 !default 设置变量覆盖的功能,但从那以后有一些提交没有添加 !default,即来自 https://github.com/gregbell/active_admin/commit/de62b3d7a68fc82f980a723f014ba844a635bea9

    我刚刚在 master 上更新了这些变量:https://github.com/gregbell/active_admin/commit/26d9b741ddb9176a8239f7508da508fccdbd8332

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-03-31
      • 1970-01-01
      • 2018-01-18
      • 2020-10-27
      • 1970-01-01
      • 2016-10-16
      • 2018-11-22
      相关资源
      最近更新 更多