0

本番環境の問題を解決できません。heroku の私の application.css は空ですが、開発中は問題ありません。

私のapplication.rbにこれを追加しました: config.assets.enabled = true config.assets.compress = false しかし、それでも動作しません。

プリコンパイルも機能していません。作成した後、heroku はマニフェスト ファイルが見つかったというメッセージを表示しますが、まだ動作していません。ロールバックするには、rake assets:clean を使用しました。メッセージは引き続き表示されます。

私に何ができる?JS を含まない CSS ファイルが 1 つしかありません。

アプリへのリンク: http://floating-hamlet-8270.herokuapp.com/

私の Application.css の一部:

/*
* This is a manifest file that'll be compiled into application.css, which will include all      the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require_tree .
*/

html, body, h1, h2, h3, h4, h5, h6, p, ul, li {
 margin: 0;
 padding: 0;
}

body {
 font-family: "Noto Sans", sans-serif;
}
4

2 に答える 2

0

次のことを試してください...

gemfile に追加:

gem 'rails_12factor', group: :production

/config/production.rb に追加:

config.serve_static_assets = true

config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'

config.assets.compile = true

https://medium.com/self-directed-learning/9ba1f595102aを参照

于 2014-03-18T05:17:37.050 に答える
0

Heroku のドキュメントから以下を参照してください。

アプリケーションで public/assets/manifest.yml が検出された場合、Heroku はアセットのコンパイルを自分で処理していると想定し、アセットのコンパイルを試みません。

ファイルを削除manifest.ymlして Heroku にアセットを管理させるか、適切に設定する必要があります。

于 2013-10-21T11:29:14.523 に答える