0

这是 Heroku 生产的页面源标题:

<head>
  <title>Gosgf</title>
  <link data-turbolinks-track="true" href="/assets/application-e11c07d8fd96415a6de17e941d115bde.css" media="all" rel="stylesheet" />
  <script data-turbolinks-track="true" src="/assets/application-786dea1c8b4a7b9d1635fb121196a3f3.js"></script>
  <meta content="authenticity_token" name="csrf-param" />
  <meta content="LAzUNgZEUmay9OLVUsN0u6Amz/9BVJngJKvE+B6+L1g=" name="csrf-token" />
</head>

这是来自 127.0.0.1:3000

<head>
  <title>Gosgf</title>
  <link data-turbolinks-track="true" href="/assets/application.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/games.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/jgo/jgoboard.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/jgo/jgoboard_small.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/sgfs.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/welcome.css?body=1" media="all" rel="stylesheet" />
  <script data-turbolinks-track="true" src="/assets/jquery.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/jquery_ujs.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/turbolinks.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/games.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/jgo/all-min.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/jgo/autodiv.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/jgo/jgoboard.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/jgo/sgf.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/jquery/jquery-1.10.1.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/jquery/jquery-1.10.1.min.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/jquery/jquery.min.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/sgfs.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/welcome.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/application.js?body=1"></script>
  <meta content="authenticity_token" name="csrf-param" />
  <meta content="8+ZHwU8R9V/V5zgoVL3fqyGKxYG2BxV2f8LtRCZNDAg=" name="csrf-token" />
</head>

Heroku 忽略了很多jscss以下。app/asserts

我已经添加了:

 gem 'rails_12factor', group: :production

在宝石文件中。

资产是预编译的:

 RAILS_ENV=production bundle exec rake assets:precompile
 git add public/assets
 git commit -m "compiled assets"

之前push

config/environments/production.rb

 config.serve_static_assets = true
 config.assets.compile = true

我如何告诉 Heroku 加载jscss资产?

4

1 回答 1

2

这是正常的 - 您的生产页面加载的 application.js 和 application.css 应该包含您应用程序的所有资产(至少是 application.css 或 application.js 清单中包含的任何内容)。

这(除其他外)是预编译所做的。

于 2013-07-10T10:49:37.383 回答