【发布时间】:2018-03-19 06:08:26
【问题描述】:
这是一个很棒的地方。我希望尽快有能力提供解决方案。
请有人帮忙!!?!
我已经观看了几个小时的 youtube,并阅读了网络上关于资产管道预编译的每篇文章。
无论出于何种原因,我决定使用 Rails 5.1.2,但我不知道这是否是问题所在。
glyphicons 不会在 Heroku 上渲染或使用
rails s -e production
在我的本地 ubuntu 上。
我输入
rake assets:precompile RAILS_ENV=production
得到
I, [2018-01-01T16:05:07.261287 #4745] INFO -- : Writing /home/dracos/rails/video-store/public/assets/glyphicons-halflings-regular-e395044093757d82afcb138957d06a1ea9361bdcf0b442d06a18a8051af57456.ttf
I, [2018-01-01T16:05:07.261968 #4745] INFO -- : Writing /home/dracos/rails/video-store/public/assets/glyphicons-halflings-regular-e395044093757d82afcb138957d06a1ea9361bdcf0b442d06a18a8051af57456.ttf.gz
I, [2018-01-01T16:05:07.263049 #4745] INFO -- : Writing /home/dracos/rails/video-store/public/assets/glyphicons-halflings-regular-fe185d11a49676890d47bb783312a0cda5a44c4039214094e7957b4c040ef11c.woff
I, [2018-01-01T16:05:07.264510 #4745] INFO -- : Writing /home/dracos/rails/video-store/public/assets/glyphicons-halflings-regular-fe185d11a49676890d47bb783312a0cda5a44c4039214094e7957b4c040ef11c.woff2
I, [2018-01-01T16:05:07.289833 #4745] INFO -- : Writing /home/dracos/rails/video-store/public/assets/application-c29c47294834d3d47956f910a3182df4a7db7d5864e82c6f758027f30669bafb.js
I, [2018-01-01T16:05:07.290028 #4745] INFO -- : Writing /home/dracos/rails/video-store/public/assets/application-c29c47294834d3d47956f910a3182df4a7db7d5864e82c6f758027f30669bafb.js.gz
I, [2018-01-01T16:05:14.175848 #4745] INFO -- : Writing /home/dracos/rails/video-store/public/assets/application-b896db4d9b9e69049347e71a1825dcdc1a4eed9147196fdd761afe6f12b556d4.css
I, [2018-01-01T16:05:14.176068 #4745] INFO -- : Writing /home/dracos/rails/video-store/public/assets/application-b896db4d9b9e69049347e71a1825dcdc1a4eed9147196fdd761afe6f12b556d4.css.gz
但是在 log/production.log 我得到了
致命 -- : [849248f2-cd3c-4912-a10d-4f63bd5857ae] ActionController::RoutingError(没有路由匹配 [GET] "/assets/glyphicons-halflings-regular.ttf"):
致命 -- : [dfae9054-ad8a-4553-85a3-c55d55b1946c] ActionController::RoutingError(没有路由匹配 [GET] "/assets/glyphicons-halflings-regular.woff"):
等等……
我不明白?!?我不会假装了解资产管道引擎盖下发生的所有巫术,并且现在不想成为新手,但是这个!?!?为什么?谁能告诉我?
我的 /app/assets/stylesheets/bootstrap.css 已修改为显示
@font-face {
font-family: 'Glyphicons Halflings';
src: url('../assets/glyphicons-halflings-regular.eot');
src: url('../assets/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),
url('../assets/glyphicons-halflings-regular.woff2') format('woff2'),
url('../assets/glyphicons-halflings-regular.woff') format('woff'),
url('../assets/glyphicons-halflings-regular.ttf') format('truetype'),
url('../assets/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}
而且,有趣的是,/assets/ 部分会被添加,即使我将其完全排除在上述文件的 url 路径之外。我已经尝试了一切。任何人都可以帮忙吗?任何帮助将不胜感激。
干杯
【问题讨论】:
标签: ruby-on-rails asset-pipeline glyphicons bootstrap-sass