您现在的位置是:首页 > 电脑 > 

为什么Rails资产管道在没有被称为“application.css.scss”时会编译CSS清单?(Why won't the Rails asset pipeline compile a CSS manifest when it's not called “application.css.scss”?)

2025-07-18 03:36:10
为什么Rails资产管道在没有被称为“application.css.scss”时会编译CSS清单?(Why won't the Rails asset pipeline compile a CSS manifest when it's not called “application.css.scss”?) 到目前为止,我的所有应用程序的CSS都通过applic
为什么Rails资产管道在没有被称为“scss”时会编译CSS清单?(Why won't the Rails asset pipeline compile a CSS manifest when it's not called “scss”?)

到目前为止,我的所有应用程序的CSS都通过scss ,如下所示:

/* ... *= require jquery-ui *= require_self *= require_tree . */ @import "bootstrap";

在调试时,我发现清单HAS被称为

我错过了一些很好的机会。 但是,如果将问题解决回原来的问题,我只关注应用程序的样式表本身。

我发现当它被称为scss ,它被编译得很好但是当名称被更改时它没有得到处理:

这样可行:

application.html.haml

... = stylesheet_link_tag "application" ...

是什么让“scss”变得特别?

为什么会这样? 为什么我不能只使用任何旧名称的清单文件?

(如果它完全相关我正在部署到Heroku)

Up until now all of my application's CSS has been served through scss which looks like this:

/* ... *= require jquery-ui *= require_self *= require_tree . */ @import "bootstrap";

On debugging I discovered that the manifest HAS to be called

There's a good chance I'm missing something. BUT on stripping the problem back to its bare essentials I looked just at the application's stylesheet itself.

What I found was that when it was called scss, it was compiled just fine but when the name was changed it didn't get processed:

So this works:

application.html.haml

... = stylesheet_link_tag "application" ...

What makes "scss" special?

Why is this going on? Why can't I just use a manifest file that has any old name?

(if it's at all relevant I'm deploying to Heroku)

最满意答案

如果要将样式表用作独立文件,则必须将样式表添加到预编译中。

# config/environments/production.rb # Precompile additional assets. # application.js, , and all non-JS/CSS in app/assets folder are already added. config.assets.precompile += %w()

You have to add stylesheets to the precompilation if you want to use them as a standalone file.

# config/environments/production.rb # Precompile additional assets. # application.js, , and all non-JS/CSS in app/assets folder are already added. config.assets.precompile += %w()

#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格

本文地址:http://www.dnpztj.cn/diannao/697371.html

相关标签:无
上传时间: 2023-08-27 09:47:16
留言与评论(共有 8 条评论)
本站网友 猪腰汤的做法
20分钟前 发表
如下所示: /* ... *= require jquery-ui *= require_self *= require_tree . */ @import "bootstrap"; 在调试时
本站网友 水性润滑剂
27分钟前 发表
it was compiled just fine but when the name was changed it didn't get processed
本站网友 天弘精选420001
21分钟前 发表
但是
本站网友 3u8506
20分钟前 发表
我的所有应用程序的CSS都通过scss
本站网友 显示驱动
17分钟前 发表
So this works
本站网友 七老八十
1分钟前 发表
本站网友 气胸手术
2分钟前 发表
它被编译得很好但是当名称被更改时它没有得到处理: 这样可行: application.html.haml ... = stylesheet_link_tag "application" ... 是什么让“scss”变得特别? 为什么会这样? 为什么我不能只使用任何旧名称的清单文件? (如果它完全相关我正在部署到Heroku) Up until now all of my application's CSS has been served through scss which looks like this