Railsアセットパイプラインを使用して、圧縮されたcssおよびjsファイルを提供していることを確認しようとしています。私はそれをすべてうまくセットアップし、物事はうまくプリコンパイルされています - また、Amazon の CloudFront CDN を使用してサービスを提供している S3 とうまく同期しています。
私は次のようにapplication.cssとapplication.jsを提供しています:
= stylesheet_link_tag "application"
= javascript_include_tag "application"
簡単に言えば、問題: MD5 サフィックスの付いたファイルがアプリケーション レイアウトに出力されていません。生の application.css と application.js のみです。
これは少し奇妙です:すべての画像には MD5 スタンプがあります。CSS/JS ファイルにはありません。
ここに私の production.config があります:
config.action_controller.perform_caching = true
# Specifies the header that your server uses for sending files
config.action_dispatch.x_sendfile_header = "X-Sendfile"
config.assets.compress = true
# Fallback to compile on demand
# config.assets.compile = true
#config.assets.precompile += %w(application.css application.js)
# Generate digests for assets URLs
config.assets.digest = true
#push the assets to amazon
config.action_controller.asset_host = Proc.new { |source, request|
if request.ssl?
"https://tekpub-assets.s3.amazonaws.com"
else
"http://tekpub-assets.s3.amazonaws.com"
end
}
config.serve_static_assets = false
このプロセス全体で腹立たしいのは、gzip されたファイルや消化されたファイルを見ることができるということです。これらのファイルは私の資産ディレクトリにあります。em のすべて - CSS および JS ファイルも同様です。
ただし、私のmanifest.ymlファイルは次のようにのみ更新されます:
---
application.js: application.js
application.css: application.css
プリコンパイルを実行してもエラーはありません。実際、すべてがかなり桃色に見えます。
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
Resolved collector.newrelic.com to 204.93.223.153
AssetSync: using /Volumes/Fatty/Sites/tpub6/config/initializers/asset_sync.rb
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
** Invoke assets:precompile:nondigest (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
Resolved collector.newrelic.com to 204.93.223.153
AssetSync: using /Volumes/Fatty/Sites/tpub6/config/initializers/asset_sync.rb
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:nondigest
AssetSync: Syncing.
Using: Directory Search of /Volumes/Fatty/Sites/tpub6/public/assets
AssetSync: Done.
ポインタ/突き刺し/ヒントをありがとう。