Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My css file is overridden due to activeadmin

First I have created an active_admin css file as app/assets/stylesheets/active_admin.css.scss

/* active_admin.css.scss */
@import "active_admin/mixins";
@import "active_admin/base";

/* application.css.scss*/
@import "active_admin.css.scss"

So I have a lot of css of mine been overriden, I followed instructions of this post but still doesn't work. I changed files location from app/assets/stylesheets/active_admin.css.scss to vendor/assets/stylesheets/active_admin.css.scss but still having the problem.

So, how can I load activeadmin css files only when needed?

like image 503
Petran Avatar asked Oct 10 '13 19:10

Petran


3 Answers

Based on seanlinsley comment on selected answer and nathan's answer too, it seems to me that the 'cleanest' way is indeed to move active_admin.css.scss from app/assets/stylesheets/ to vendor/assets/stylesheets/.

No need to any other (configuration) modification: 'main' app has it's styles back to normal and AA display is normal too.

(I didn't want to manually include each of my ressources instead of require_tree ... !)

This is the way AA is getting into: AA (still) opened issue on the matter.

like image 120
gfd Avatar answered Oct 14 '22 05:10

gfd


For active_admin to play nice don't include it in the application.css, i.e.: remove the

require_tree .

and require each file separately inside app/assets/stylesheets but don't put active_admin.css

and on config/production.rb put this

config.assets.precompile += ['active_admin.css']
like image 37
jimagic Avatar answered Oct 14 '22 06:10

jimagic


What worked for me (Rails 5) was adding the following line on my app/assets/stylesheets/application.css after the *= require_self line:

*= stub "active_admin"
like image 14
Maya Novarini Avatar answered Oct 14 '22 07:10

Maya Novarini