我试图确保我使用Rails资产管道提供压缩的css和js文件.我已经很好地设置了这一切,事情正在快速预编译,并且还快速地同步到S3,在那里我使用Amazon的CloudFront CDN为他们提供服务.
我正在为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
当我运行预编译时,没有错误 – 其实一切看起来都比较peachy:
** 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.
感谢任何指针/推/提示.