Ask A Question

Notifications

You’re not receiving notifications from this thread.

Override CSS in Gem with CSS from app

Neil Tonge asked in Rails

Hi,

I'm working on a Rails Gem. The gem provides one view and a basic stylesheet for it.

When installed in an app, i'd like to be able to override the basic styles with other styles in the app itself. How can this be done? I'm confused as i'm not sure how to link the new styles to the view when the view is part of the gem. I don't wish to duplicate the view into the app though. Just wish to write an override set of styles and have that apply to that one view template.

I was thinking about somehow specifying a config option where a path to a file can be set, and if this is configured then it will conditionally show in the view. Is this the right approach or is there a better way?

Thanks,
Neil

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.