我的一些资产停止在本地加载。我试过了:
rake tmp:cache:clear
rake assets:clean
rake assets:clobber
然后
rake assets:precompile
在我这样做之后,我甚至比这些命令更多
GET /assets/application.self-60df922d9e18a377003de2b30c64d5bf97ede1dd247b2c01c78528867d89d22f.css
GET /assets/local_time.self-128a04d66b2846a17e046fdf49e35ae00618c9e472c0021c2f949a8d17f7a9a8.js
GET /assets/bootstrap.min.self-075878ec6a19d24f3b46052eb9e0e5bb5c2a098ac50d05d8e3a21309d129273a.js
等等。
assets.rb
Rails.application.config.assets.version = '1.0'
Rails.application.config.assets.precompile += %w( pages.css )
Rails.application.config.assets.precompile += %w( dashboard.css )
Rails.application.config.assets.precompile += %w( initial_settings.css )
Rails.application.config.assets.precompile += %w( settings.css )
application.rb中
.
.
.
config.assets.paths << Rails.root.join('vendor', 'assets', 'components')
.
.
.
的application.js
// = require jquery
// = require jquery.turbolinks
// = require jquery_ujs
// = require dataTables/jquery.dataTables
// = require metisMenu.min
// = require sb-admin-2
// = require local_time
// = require bootstrap.min
// = require turbolinks
// = require_tree .
application.scss
*= require_self
*= require pages
*= require sb-admin-2
*= require metisMenu.min
*= require dataTables/jquery.dataTables
*= timeline
*/
body,
h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
font-family: "avenir next", Helvetica, Arial, sans-serif!important;
}
@import "bootstrap-sprockets";
@import "bootstrap";
环境/ development.rb
config.assets.debug = true
config.assets.digest = true
config.assets.raise_runtime_errors = true
通常我可以回到旧的提交并开始工作,然后回过头来进行更改,但即使我回滚,也会遇到这些错误。
我正在使用ngrok,所以我可以看到所有这些请求以500错误结束,而GET请求是相同的资产名称,无论我是rake assets:clean
。我也没有更改资产,所以文件名可能不会改变,但可能存在缓存问题?
当我运行资产:预编译时,看起来我的application.js
和application.scss
未进行预编译,即使我的assets.rb
文件显示:
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.