10

Where can i put custom css files to customize ActiveAdmin CSS?

I see in active_admin.rb there is the following line:

config.register_stylesheet 'active_admin.css'

but i can't understand where the file has to go. All i want to do is add some extra custom styles to AA's default ones

2 Answers 2

20

Lets say I have 2 css files, highlight.css and select2.css

In config/initializers/active_admin.rb, I would add it like this:

config.register_stylesheet 'highlight.min.css'
config.register_stylesheet 'select2.css'

Note:

highlight.css and select2.css should be inside/under app/assets/stylesheets

Sign up to request clarification or add additional context in comments.

4 Comments

ok it actually worked but i realized that you cannot name those file: active_admin.css otherwise it will override the whole thing!
Oh. I didnt knew that.
Or you can just @import those files inside active_admin.css
0

To keep separate directory for admin style-sheet.

I am using gem 'activeadmin' in an application. I wanted to use my own style-sheet which stored in separate directory, here is how I archive that-

  1. Created new directory as admin inside style-sheet .
    Ex. app/assets/stylesheets/admin
  2. Opened config/initializers/active_admin.rb.
  3. Looked for register_stylesheet and found commented line as-

    # config.register_stylesheet 'my_stylesheet.css'

  4. Modified this line with-

    config.register_stylesheet 'admin/active_style.css'

  5. Restart rails server and found desired result.

Hope will work for you!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.