带链轮的 Rails 7,在开发中启用已编译 css 中的原始文件
我刚刚使用 --css bootstrap 启动了一个新的 Rails 7 项目,但我发现使用 bin/dev
启动服务器,编译后的 css 不再(如以前的 Rails 版本中那样)输出注释以及文件的文件名和行号,在其中可以找到每个 scss 类定义。
实际上,我对新的 Rails 如何与 scss 和 css 一起使用感到相当困惑,似乎 css 根本没有被编译。我找不到任何好的资源来理解它是如何工作的。有什么建议吗?
谢谢,
I just started a new rails 7 project with --css bootstrap, but I'm finding that starting the server with bin/dev
the compiled css does no longer (as in previous rails versions) output a comment with the file name and line number of the file where to find each scss class definition.
I'm actually rather confused on how the new rails works with scss and css, it doesn't seem that the css is compiled at all. I couldn't find any good resources for understanding how it works. any suggestions?
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
默认情况下,Sprockets 似乎不生成源映射。
您可以尝试打开此文件:
config/environments/development.rb
并添加以下行:
config.assets.debug = true
Sprockets doesn't seem to generate sourcemaps by default.
You can try opening up this file:
config/environments/development.rb
And adding the line:
config.assets.debug = true
din/dev
文件的内容是什么?Rails 7 也摆脱了 webpack:
Rails 7 现在使用 importmaps,因此根据您的 gem 文件,您可能必须使用 css-bundling。调查一下 dartsass 以及 propshaft,它取代了他们未来考虑做的链轮,以获得更好的想法。
What are the contents of you
din/dev
file?Also rails 7 got rid of webpack:
Rails 7 now uses importmaps, so depending on your gem file you might have to use css-bundling. Look into that and dartsass along with propshaft, which replaces sprockets which they are thinking about doing in the future, to get a better idea.