英文:
Background image not compiling into assets folder using propshaft with dartsass-rails in rails 7
问题
在使用Rails 7与Propshaft和dartsass-rails时,我刚从sassc-rails迁移到dartsass-rails,它将sprockets作为资源管道库移除了。
我在CSS中声明了一个背景图像,代码如下:background-image: image-url('fancy_background.png');
,该图像位于app/assets/images/fancy_background.png
目录下。
这个图像在资源文件夹中没有显示出来。其他在HTML中声明的图像可以正常加载。请问在CSS中如何以“新”的方式引用图像?
英文:
Using Rails 7 with Propshaft and dartsass-rails. I've just migrated from sassc-rails to dartsass-rails which drops sprockets as the asset pipeline library
I have a background image declared in CSS with background-image: image-url('fancy_background.png');
the image is in app/assets/images/fancy_background.png
The image is not showing up in the assets folder. Other images which are declared in the HTML do get pulled in. How should I be referencing images in CSS with the "new" way?
答案1
得分: 0
这里的问题是从 sprockets 迁移到 propshaft。
现在需要仅使用 url
引用背景图像,例如:
background-image: url('/fancy_background.png');
来源: https://github.com/rails/propshaft/blob/main/UPGRADING.md#3-migrate-from-sprockets-to-propshaft
英文:
The issue here was migrating from sprockets to propshaft.
Background images now need to be referenced with just url
EG:
background-image: url('/fancy_background.png');
Source: https://github.com/rails/propshaft/blob/main/UPGRADING.md#3-migrate-from-sprockets-to-propshaft
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论