0

What is the equivelant of this in ruby on rails? I have installed bootstrap but my scss files are not reaching my html.erb files.

<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>

Thanks

user2026178
  • 308
  • 2
  • 4
  • 21

1 Answers1

1

Just a shot in the dark, as we're not seeing how you have your stylesheets configured for your app, but I know there's some pretty specific (though somewhat awkward to locate) directions for establishing SCSS with Bootstrap within the GitHub documentation. Give this a shot (if you haven't already):

Import Bootstrap styles in app/assets/stylesheets/application.scss:

// Custom bootstrap variables must be set or import before bootstrap itself.
@import "bootstrap";

Make sure the file has .scss extension (or .sass for Sass syntax). If you have just generated a new Rails app, it may come with a .css file instead. If this file exists, it will be served instead of Sass, so rename it:

$ mv app/assets/stylesheets/application.css
app/assets/stylesheets/application.scss

Then, remove all the *= require and *= require_tree statements from the Sass file. Instead, use @import to import Sass files.

Do not use *= require in Sass or your other stylesheets will not be able to access the Bootstrap mixins and variables.

This was all located here: https://github.com/twbs/bootstrap-rubygem#a-ruby-on-rails

I don't follow the instruction to remove all the *= require and *= require_tree statements... I just leave them, but when adding your @import statements within your application.scss file (once it's renamed), be sure to have

@import "bootstrap-sprockets";

@import "bootstrap";

listed in that order with the file.

VLS
  • 2,306
  • 4
  • 22
  • 17
S Ellis
  • 26
  • 2
  • 1
    Oh... and my link tag for locating SCSS files is then: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> (auto-generated that way, when I establish my Rails project the way I do) – S Ellis Jan 03 '16 at 15:52
  • Sorry for the ambiguity. I have bootstrap working nicely, however, when I attempt to edit my scss (to change colours of all

    headings for example), it simply does not work.

    – user2026178 Jan 24 '16 at 02:49