Administrate: How to add custom CSS?

Created on 7 Feb 2017  路  4Comments  路  Source: thoughtbot/administrate

Hi :) How can I add custom css to the dashboard?

Most helpful comment

I've managed to add custom stylesheets through these steps. Create an initializer like so:

# config/initializers/administrate.rb
Administrate::Engine.add_stylesheet('your_stylesheet_name')

You might also have to add it to be compiled through the asset pipeline, which also can be done through an initializer:

# config/initializers/assets.rb
Rails.application.config.assets.precompile += %w(your_stylesheet_name.css)

Don't forget to restart your Rails server after adding/editing these files.

All 4 comments

I've managed to add custom stylesheets through these steps. Create an initializer like so:

# config/initializers/administrate.rb
Administrate::Engine.add_stylesheet('your_stylesheet_name')

You might also have to add it to be compiled through the asset pipeline, which also can be done through an initializer:

# config/initializers/assets.rb
Rails.application.config.assets.precompile += %w(your_stylesheet_name.css)

Don't forget to restart your Rails server after adding/editing these files.

@lauroengineer Does the method outlined by @klaseskilson work for you? If so, would you consider this issue as resolved?

@carlosramireziii sorry about that. Yes, It worked! Thanks you @klaseskilson 馃憤

I did ruby rails generate administrate:assets:stylesheets instead and imported my stylesheets there.

Was this page helpful?
0 / 5 - 0 ratings