Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set the standard :css_filename option for sass. This enables relative…
… path calculations for assets referred to by the stylesheet.
- Loading branch information
1 parent
005e6eb
commit 0b43583
Showing
1 changed file
with
5 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0b43583
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This led to a circular require regression in my app. No luck coming up with a minimal reproduction, yet, though.
0b43583
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a pretty simple refactoring. It's hard to understand how that could happen.
0b43583
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happens when precompiling assets. Frustratingly, it's easy to repro in my app, but I couldn't get a minimal repro going in sass-rails tests or in a sample app.
I'm referencing an asset path in
foo.js.erb
:<%= asset_path 'application.css' %>
. This JavaScript is compiled before the stylesheet, so, after this commit, referencing the asset path forcesapplication.css
to be compiled.Any import in
application.css
throws a circular require error. With just@import "foo";
inapplication.css
, I see asset lookups for bothfoo
andfoo.css
logical paths. These resolve to the same path, hence the error.Pretty confusing; I'll need to step through in a debugger to see what's actually going on.
0b43583
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like someone else reproduced @ rails/rails#4151
0b43583
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a bug with sprockets then. Why does getting the public path cause compilation? I need to tell sass what the css filename is going to be so that relative path computation can be performed. Is there a different sprockets method I should call?
0b43583
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0b43583
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be ok if it was just the non-digested version of the filename for now. Is there a way of getting at that without compiling and without sass-rails making assuptions about sprockets internals?
0b43583
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep: 7cd6c0e
0b43583
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent.