我使用以下资产:
$ ls app/assets/javascripts/
application.js jquery-1.7.2.min.js rails.js
date-picker.js jquery-ui-1.8.22.custom.min.js row_shading.js
default_on_first_input_field.js long_or_short_details.js sortable_hook.js
$
$ ls app/assets/stylesheets/
application.css default.scss.css jquery-ui-1.8.22.custom.css main.css
他们在本地工作都很好,当我推到heroku时也是如此。
但是我注意到当我推到Heroku时,我看到了:
...
Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
Compiled jquery-1.7.2.min.js (2ms) (pid 690)
Compiled jquery-ui-1.8.22.custom.min.js (3ms) (pid 690)
Compiled default_on_first_input_field.js (0ms) (pid 690)
Compiled row_shading.js (0ms) (pid 690)
Compiled long_or_short_details.js (0ms) (pid 690)
Compiled sortable_hook.js (0ms) (pid 690)
Compiled date-picker.js (0ms) (pid 690)
Compiled application.js (68ms) (pid 690)
Compiled main.css (0ms) (pid 690)
Compiled default.scss.css (0ms) (pid 690)
Compiled jquery-ui-1.8.22.custom.css (0ms) (pid 690)
Compiled application.css (33ms) (pid 690)
Compiled jquery-1.7.2.min.js (1ms) (pid 690)
Compiled jquery-ui-1.8.22.custom.min.js (3ms) (pid 690)
Compiled default_on_first_input_field.js (0ms) (pid 690)
Compiled row_shading.js (0ms) (pid 690)
Compiled long_or_short_details.js (0ms) (pid 690)
Compiled sortable_hook.js (0ms) (pid 690)
Compiled date-picker.js (0ms) (pid 690)
Compiled application.js (39ms) (pid 690)
Compiled main.css (0ms) (pid 690)
Compiled default.scss.css (0ms) (pid 690)
Compiled jquery-ui-1.8.22.custom.css (0ms) (pid 690)
Compiled application.css (12ms) (pid 690)
Asset precompilation completed (24.06s)
-----> WARNINGS:
No Procfile detected, using the default web server (webrick)
https://devcenter.heroku.com/articles/ruby-default-web-server
...
可能导致
加倍的原因 jquery-1.7.2.min.js
jquery-ui-1.8.22.custom.min.js
default_on_first_input_field.js
row_shading.js
long_or_short_details.js
sortable_hook.js
date-picker.js
application.js
main.css
default.scss.css
jquery-ui-1.8.22.custom.css
我的清单有:
$ cat app/assets/javascripts/application.js
// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
//
//= require jquery-1.7.2.min
//= require jquery-ui-1.8.22.custom.min
//= require default_on_first_input_field
//= require row_shading
//= require long_or_short_details
//= require sortable_hook
//= require date-picker
//= require_self
20:44:18 durrantm Castle2012 /home/durrantm/Dropnot/_/rails_apps/linker master
$ cat app/assets/stylesheets/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 'main'
*= require_self
*= require_tree .
*/
[新增:生产.rb]
$ cat config/environments/production.rb
Linker::Application.configure do
config.cache_classes = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.serve_static_assets = false
config.assets.compress = true
config.assets.compile = false
config.assets.digest = true
config.assets.precompile += %w(default.scss.css main.css jquery-ui-1.8.22.custom.css)
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
end
$