Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
215 views
in Technique[技术] by (71.8m points)

Rails Active Admin css conflicting with Twitter Bootstrap css

I'm somewhat new to the Rails asset pipeline so I might be doing something wrong. I'm trying to use Active Admin for my backend and twitter bootstrap css for my front end application.

I added the bootstrap.css to /app/assets/stylesheets then also added:

//= require bootstrap

to application.css - then I did a precompile of the assets locally

It seems to work fine but some of the styling isn't coming through exactly and I think it's because active admin's css is overriding it.

My understanding is that the application compiles the css assets into the application css public asset and the application uses that file when running.

I need to somehow separate the two and make it use twitter bootstrap css as the main css on the front end and maybe tell it not to use active admin's css files on the front end.

What's the best way to do this?

question from:https://stackoverflow.com/questions/10180418/rails-active-admin-css-conflicting-with-twitter-bootstrap-css

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had the same problem, and was able to fix it by moving

app/assets/stylesheets/active_admin.css.scss

to

vendor/assets/stylesheets/active_admin.css.scss

The active admin assets should be in vendor/ as mentioned in the rails guide:

"Vendor/assets is for assets that are owned by outside entities, such as code for JavaScript plugins and CSS frameworks."


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...