pastullo
pastullo

Reputation: 4201

ActiveAdmin and additional custom CSS files

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

Upvotes: 10

Views: 11701

Answers (2)

S.Yadav
S.Yadav

Reputation: 4509

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!

Upvotes: 0

Midhun Krishna
Midhun Krishna

Reputation: 1759

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

Upvotes: 20

Related Questions