简体   繁体   中英

Rails6 disable ActiveAdmin layout for all non-ActiveAdmin pages

My Rails 6 app has no css or any styling at all. I'm using Devise and now I added Active Admin - It turned out that ActiveAdmin changed the appearance of all pages. How to disable Active Admin layout for non-ActiveAdmin views?

ActiveAdmin adds these files:

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

In order to avoid the override of your application style with the Active Admin one, you can do one of these things:

  1. You can properly move the generated file active_admin.scss from app/assets/stylesheets to 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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