manuelvanrijn / bootstrap-switch-rails

A small gem for putting bootstrap-switch into the Rails asset pipeline
MIT License
58 stars 18 forks source link

SASS Import does not work #13

Closed jgegenfurtner closed 9 years ago

jgegenfurtner commented 9 years ago

Hello,

I installed this gem following the README. I included bootstrap-switch in my SASS stylesheets using the "import" statements as described there (btw, the statements include semicolons; didn't SASS get rid of semicolons?!).

@import "bootstrap3-switch"

This leads to the following error message (development mode):

Sass::SyntaxError
...
File to import not found or unreadable: bootstrap3-switch.
Load paths:
...
  /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/bootstrap-switch-rails-3.3.2/vendor/assets/javascripts
  /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/bootstrap-switch-rails-3.3.2/vendor/assets/stylesheets
...

However, when I use the CSS import *= require bootstrap3-switch there is no error message and the CSS file gets loaded (from the produced HTML): <link data-turbolinks-track="true" href="/assets/bootstrap3-switch.self.css?body=1" media="all" rel="stylesheet" />

So I guess there is something wrong with the SASS import.

I identified the problem and found a solution. Problem: the SASS import filename statement tries to import "_filename.scss". Solution: use import "bootstrap3-switch.css.scss" in your application.css.sass

You should update the README or change the files to "_bootstrap3-switch.scss".

yoonwaiyan commented 9 years ago

I've seen this error right after bundle install but restart the server solved this problem.

manuelvanrijn commented 9 years ago

@jgegenfurtner did this also resolved this issue for you?

jgegenfurtner commented 9 years ago

No, as I said, bundle install does/did not resolve this issue.

I could resolve it instead using explicit stylesheet import in my "application.css.sass" as described above in my first post:

@import "bootstrap3-switch.css.scss"