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?
What worked for me (Rails 5) was adding the following line on my app/assets/stylesheets/application.css
Remove this line from your app/assets/stylehseets/application.css.sass
Move active_admin.css.scss to vendor/assets/stylesheets/
For active_admin to play nice don't include it in the application.css, i.e.: remove the
and require each file separately inside app/assets/stylesheets but don't put active_admin.css
and on config/production.rb put this
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
fromapp/assets/stylesheets/
tovendor/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.
This is the link that addresses this issue. I am reposting an existing answer that I found very helpful because it also addressed the js issues. Again Not My Answer.
https://github.com/activeadmin/activeadmin/issues/3819#issuecomment-351377822
the same problem I faced and I have solved this following below:
Firstly you have to create a directory named assets in the vendor directory,
Then in the assets directory of vendor folder, you have to create two directories (i) stylesheets and the second one is (ii) javascripts.
After that, you have to move the active_admin.scss file from
assets/stylesheets
tovendor/assets/stylesheets
and theactive_admin.js.coffee
file fromassets/javascripts
tovendor/assets/javascripts
,And finally, restart your rails server then reload your apps. Hope this will work for you.