【问题标题】:Rails6 disable ActiveAdmin layout for all non-ActiveAdmin pagesRails6 禁用所有非 ActiveAdmin 页面的 ActiveAdmin 布局
【发布时间】:2021-07-20 16:32:42
【问题描述】:

我的 Rails 6 应用根本没有 CSS 或任何样式。我正在使用 Devise,现在我添加了 Active Admin - 结果发现 ActiveAdmin 改变了所有页面的外观。如何禁用非 ActiveAdmin 视图的 Active Admin 布局?

ActiveAdmin 添加这些文件:

app/assets/stylesheets/active_admin.scss

// 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.scss` in the
// Active Admin source.
//
// For example, to change the sidebar width:
// $sidebar-width: 242px;

// Active Admin's got SASS!
@import "active_admin/mixins";
@import "active_admin/base";

// Overriding any non-variable Sass must be done after the fact.
// For example, to change the default status-tag color:
//
//   .status_tag { background: #6090DB; }

app/assets/javascripts/active_admin.js

// 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.scss` in the
// Active Admin source.
//
// For example, to change the sidebar width:
// $sidebar-width: 242px;

// Active Admin's got SASS!
@import "active_admin/mixins";
@import "active_admin/base";

// Overriding any non-variable Sass must be done after the fact.
// For example, to change the default status-tag color:
//
//   .status_tag { background: #6090DB; }

【问题讨论】:

    标签: javascript css ruby-on-rails activeadmin


    【解决方案1】:

    我只是引用 ActiveAdmin gotchas 部分

    为了避免使用 Active Admin 一,您可以执行以下操作之一:

    1. 您可以正确移动生成的文件 active_admin.scss 从 app/assets/stylesheets 到 vendor/assets/stylesheets。
    2. 您可以删除 根级 css 文件中的所有 require_tree 命令,其中 active_admin.scss 在树中。

    https://github.com/activeadmin/activeadmin/blob/master/docs/14-gotchas.md#css

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多