带字形的路由错误 rails
RoutingError with glyphicon rails
我使用这个 gem 作为引导程序,但是没有显示 glyphicon。我得到这个错误:
ActionController::RoutingError (No route matches [GET]
"/assets/twitter/fonts/glyphicons-halflings-regular.woff"):
ActionController::RoutingError (No route matches [GET]
"/assets/twitter/fonts/glyphicons-halflings-regular.ttf"):
我尝试在我的资产中创建包含字体的文件夹,但这对我没有帮助。
一个解决方案是将文件放在应用程序的 public 目录中。在你的情况下它将是:
(Rails_app)/public/assets/twitter/fonts/glyphicons-halflings-regular.woff
(Rails_app)/public/assets/twitter/fonts/glyphicons-halflings-regular.ttf
Public 文件是您应用程序的根目录。
我使用以下步骤解决问题:
- 从 github 站点手动下载 bootstrap 压缩包:https://github.com/twbs/bootstrap
- 上传然后解压到生产服务器/tmp 文件夹
- 在 %approot/public/assets/twitter/fonts
下手动创建文件夹
- 复制'bootstrap-master/fonts/*'到上面的文件夹
- RAILS_ENV=production bundle exec rake assets:precompile
- 重新启动 rails 个服务器
我使用这个 gem 作为引导程序,但是没有显示 glyphicon。我得到这个错误:
ActionController::RoutingError (No route matches [GET] "/assets/twitter/fonts/glyphicons-halflings-regular.woff"):
ActionController::RoutingError (No route matches [GET] "/assets/twitter/fonts/glyphicons-halflings-regular.ttf"):
我尝试在我的资产中创建包含字体的文件夹,但这对我没有帮助。
一个解决方案是将文件放在应用程序的 public 目录中。在你的情况下它将是:
(Rails_app)/public/assets/twitter/fonts/glyphicons-halflings-regular.woff
(Rails_app)/public/assets/twitter/fonts/glyphicons-halflings-regular.ttf
Public 文件是您应用程序的根目录。
我使用以下步骤解决问题:
- 从 github 站点手动下载 bootstrap 压缩包:https://github.com/twbs/bootstrap
- 上传然后解压到生产服务器/tmp 文件夹
- 在 %approot/public/assets/twitter/fonts 下手动创建文件夹
- 复制'bootstrap-master/fonts/*'到上面的文件夹
- RAILS_ENV=production bundle exec rake assets:precompile
- 重新启动 rails 个服务器