Why do I have to require bootstrap if I'm using the gem

245 views
Skip to first unread message

fugee ohu

unread,
Sep 20, 2019, 8:42:32 AM9/20/19
to Ruby on Rails: Talk
?

Walter Lee Davis

unread,
Sep 20, 2019, 8:52:22 AM9/20/19
to rubyonra...@googlegroups.com
If you mean in your JavaScript or (S)CSS "application" pages, that's because there's no other mechanism that a gem could use to auto-mount the paths there. The Bootstrap gem is essentially just providing packaging for the JS and CSS that is Bootstrap. That last few inches is you adding it to your application in a thoughtful way, just as you would any other JS or (S)CSS file.

If there were an "automatic" way to add it, it would probably be like the CSS ` *= require_tree .` construct, which works alphabetically. That would ignore any overrides you wanted to set, or in the case of SCSS, any variables you wanted to populate with values. Doing things the long-hand way gives you a chance to ensure that requirements are met and there's a predictable order to loading. The same sort of thing would be even more critical in JS, where alphabetical order might load a jQuery plugin before jQuery itself.

Walter

> On Sep 20, 2019, at 8:42 AM, fugee ohu <fuge...@gmail.com> wrote:
>
> ?
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/24df8def-a4da-4459-bdfa-f1b4d3a02812%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages