Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';推到Heroku后找不到CSS_Css_Heroku_Ruby On Rails 4_Asset Pipeline - Fatal编程技术网

Can';推到Heroku后找不到CSS

Can';推到Heroku后找不到CSS,css,heroku,ruby-on-rails-4,asset-pipeline,Css,Heroku,Ruby On Rails 4,Asset Pipeline,当我在本地运行时,一切正常,但当我推到heroku时失败。我发现我需要修改app/assets/stylesheets/中的所有.css文件,使其具有.css.scss扩展名,并确保我的文件包含: gem 'sass-rails', '4.0.1' group :production, :staging do gem 'rails_12factor' # for heroku end 在我的.css.scss文件中,我现在使用image-url()而不是url()来指向指纹图像(由hero

当我在本地运行时,一切正常,但当我推到heroku时失败。我发现我需要修改
app/assets/stylesheets/
中的所有.css文件,使其具有
.css.scss
扩展名,并确保我的文件包含:

gem 'sass-rails', '4.0.1'
group :production, :staging do
  gem 'rails_12factor' # for heroku
end
在我的
.css.scss
文件中,我现在使用
image-url()
而不是
url()
来指向指纹图像(由heroku和资产编译业务进行指纹识别和重组)

app/views/layouts/mycontrollername.html.erb
中:

<head>
  ...
  <%= stylesheet_link_tag "path/to/css/file" %>
</head>

...
但我还是找不到正确的道路。当我查看源代码时,除了指纹之外,我看到了预期的路径:
path/to/css/file.css
而不是
path/to/css/file-somemd5hash.css
。请注意,该路径不包括assets/path/to/css/file

编辑
我已经确认在public/assets/中heroku上没有编译过的css文件。有一个application.js文件(它是空的),尽管每个控制器都有一个.js.coffee文件。我没有application.css,每个控制器只有一个.css。

这个宝石帮助我克服了它,我想它很快就会合并到rails master中:

gem“链轮\u更好\u错误”


我没有一个很好的答案,但是这个解决方法对我来说很有效:在
config/environments/production.rb
comment out
config.serve\u static\u files=ENV['RAILS\u serve\u static\u files'].呈现?
并用
config.serve\u static\u files=true
替换它,我希望知道为什么这样做。。。