У меня есть веб-приложение, которое я развернул в Heroku. В приложении я использую глификон Bootstrap, установленный с помощью Bower. Я понимаю, что это распространенная проблема, но ни одно из решений, которые я видел, не продало эту проблему для меня.Rails 4 locating bootstrap glyphicons на Heroku
Я изменил мой bootstrap.css.scss содержать следующее:
@font-face {
font-family: 'Glyphicons Halflings';
src: url(asset_path('glyphicons-halflings-regular.eot'));
src: url(asset_path('glyphicons-halflings-regular.eot?#iefix')) format('embedded-opentype'), url(asset_path('glyphicons-halflings-regular.woff2')) format('woff2'), url(asset_path('glyphicons-halflings-regular.woff')) format('woff'), url(asset_path('glyphicons-halflings-regular.ttf'))format('truetype'), url(asset_path('glyphicons- halflings-regular.svg#glyphicons_halflingsregular')) format('svg');
}
А потом в моем application.rb
config.assets.paths << Rails.root.join('vendor', 'assets', bower_components', 'fonts')
config.assets.precompile += %w(*.eot *.svg *.ttf *.woff *.otf *.woff2)
В моем production.rb у меня есть:
config.serve_static_files = true
config.assets.compress = true
config.assets.compile = true
config.assets.digest = true
config.assets.precompile += %w('.woff', '.eot', '.svg', '.ttf')
Когда я проверяю свою консоль на героку, я получаю следующие ошибки, сопровождающие отсутствующие шрифты для глификонов:
GET http://hipster-meet.herokuapp.com/glyphicons-halflings-regular.woff2
GET http://hipster-meet.herokuapp.com/glyphicons-halflings-regular.woff
GET http://hipster-meet.herokuapp.com/glyphicons-halflings-regular.ttf
Когда я искать файлы на Heroku я нахожу:
glyphicons-halflings-regular-13634da87d9e23f8c3ed9108ce1724d183a39ad072e73e1b3d8cbf646d2d0407.eot
glyphicons-halflings-regular-13634da87d9e23f8c3ed9108ce1724d183a39ad072e73e1b3d8cbf646d2d0407.eot.gz
glyphicons-halflings-regular-42f60659d265c1a3c30f9fa42abcbb56bd4a53af4d83d316d6dd7a36903c43e5.svg
glyphicons-halflings-regular-42f60659d265c1a3c30f9fa42abcbb56bd4a53af4d83d316d6dd7a36903c43e5.svg.gz
glyphicons-halflings-regular-a26394f7ede100ca118eff2eda08596275a9839b959c226e15439557a5a80742.woff
glyphicons-halflings-regular-e395044093757d82afcb138957d06a1ea9361bdcf0b442d06a18a8051af57456.ttf
glyphicons-halflings-regular-e395044093757d82afcb138957d06a1ea9361bdcf0b442d06a18a8051af57456.ttf.gz
я интерпретирую это означает, что Bootstrap ссылается на файлы, но без хэш добавил звездочками. Есть ли в любом случае для меня, чтобы Bootstrap указывал на правильное местоположение.
Вы попробовали? Это сработало? – Elvn
Нет, это не решило проблему. –
Хорошо. Спасибо за ответ. – Elvn