sass-rails: file.css(.scss).erb causes `File to import not found or unreadable`

Using the ERB handler breaks reading/importing the files…

This works:

// application.css.scss:
@import 'tester'

// tester.css(.scss)
body { color: #ABC; }

This does not:

// application.css.scss:
@import 'tester'

// tester.css(.scss).erb
body { color: #ABC; }

Sass::SyntaxError: File to import not found or unreadable

At first I thought it was related to #119 or #94, but those fixes don’t solve my problem. I do use Rails 4.0.0.beta1 (together with sass-rails 4.0.0.beta1), so perhaps this could be related?

About this issue

  • Original URL
  • State: closed
  • Created 14 years ago
  • Comments: 35 (10 by maintainers)

Commits related to this issue

Most upvoted comments

I;m still having the same issue. sass-rails (5.0.6). “rails”, “~> 5.1.0.beta1”

Lol, having the same problem again after 1,5 years…

It looks like .scss.erb file doesn’t work in subfolders, moving it to the assets/stylesheets folder directly worked for me.

Issue ongoing in 2018.

@jrochkind I just got back to upgrading to sprockets 4 on the same codebase I was on 3 years ago, and ran into a similar error, and searched google, and found my own conversation with you here, and had a momentary loss of sanity.

But to update you on your hypothesis with what was wrong last time - yes I did need to modify manifest.js slightly as per your blogpost; that was no problem. My bigger, weirder issue, which I just solved, was that sprockets running in test under capybara only did not like my app/stylesheets/x.scss files to have a .scss.erb extension, even tho some of those files imported @import "./config/x" where x is typography but the actual file is config/typography.scss.erb. So I was getting the exact error in this thread, only under test, until I changed the top level stylesheets files to not use erb, even tho they still import some erb files.

very weird.

a year later and I’m experiencing the same problem - does .scss.erb still not work in subfolders with sprockets 4 manifest? or is my setup wrong somehow?