简体   繁体   English

Rails6 禁用所有非 ActiveAdmin 页面的 ActiveAdmin 布局

[英]Rails6 disable ActiveAdmin layout for all non-ActiveAdmin pages

My Rails 6 app has no css or any styling at all.我的 Rails 6 应用程序没有 css 或任何样式。 I'm using Devise and now I added Active Admin - It turned out that ActiveAdmin changed the appearance of all pages.我正在使用 Devise,现在我添加了 Active Admin - 结果 ActiveAdmin 改变了所有页面的外观。 How to disable Active Admin layout for non-ActiveAdmin views?如何禁用非 ActiveAdmin 视图的 Active Admin 布局?

ActiveAdmin adds these files: 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; }

I'm simply quoting from ActiveAdmin gotchas section我只是引用 ActiveAdmin gotchas 部分

In order to avoid the override of your application style with the Active Admin one, you can do one of these things:为了避免使用 Active Admin 覆盖您的应用程序样式,您可以执行以下操作之一:

  1. You can properly move the generated file active_admin.scss from app/assets/stylesheets to vendor/assets/stylesheets.您可以将生成的文件 active_admin.scss 从 app/assets/stylesheets 正确移动到 vendor/assets/stylesheets。
  2. You can remove all require_tree commands from your root level css files, where the active_admin.scss is in the tree.您可以从根级 css 文件中删除所有 require_tree 命令,其中 active_admin.scss 位于树中。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM