-
Notifications
You must be signed in to change notification settings - Fork 247
Bug on url() in stylesheets #503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You can also note that if I include |
All the sort_*.png images are for datatables and shouldn't need to put them in public/images, the ones from the datatables.net-zf package should be used. I opened a bug on sprockets-rails: rails/sprockets-rails#503
If you look at the CSS debugger of the browser you'll see that the background-image doesn't have any hash digest as it should. |
I found the problem which was actually pretty dumb. In manifest.js we have this line by default And the thing is, rails doesn't look for the assets relatively to your stylesheet or even relatively to So the right path, which I hadn't tried before was |
Now an issue remains for libraries. I have datatables.net-zf in my node_modules. I tried doing this in manifest.js: |
@paul-mesnilgrente, did you ever get anywhere with this? I'm having a similar problem with |
I think I have the same information in here: https://stackoverflow.com/questions/71423330/bug-on-url-in-scss-files-on-rails-7/71423760?noredirect=1#comment137148760_71423760 But I wrote:
If this can help you :) |
I created a simple repository https://github.com/paul-mesnilgrente/rails-7-url to reproduce my problem. The only interesting part is in application.sass.scss:
background-image: url('images/background.jpg')
. The file isapp/assets/images/background.jpg
.I tried a few variants of this path:
/images/background.jpg
,../images/background.jpg
,./images/background.jpg
but nothing works. The translated URL in the browser will always give a 404.I saw a few PRs (#489, #476) around this lately but I didn't find how to fix my problem still.
It feels very strange that it doesn't work on a fresh rails project and nobody complained about it so I must miss something simple...
The text was updated successfully, but these errors were encountered: