【问题标题】:What is the proper file path for Bootstrap 2.3.2 Glyphicons?Bootstrap 2.3.2 Glyphicons 的正确文件路径是什么?
【发布时间】:2013-10-12 17:00:14
【问题描述】:

我一直在四处搜索,发现大量不同的建议文件路径,但没有一个适合我。

我要把background-image: url("/../img/glyphicons-halflings.png");改成什么?

【问题讨论】:

  • 您将 png 文件放在项目中的什么位置?
  • /Users/adamzerner/collegeanswerz/app/assets/images/glyphicons-halflings.png
  • 如果你没有对你的资产设置做一些花哨的事情,那么它应该是/assets/glyphicons-halflings.png。通常人们会把他们没有写的东西放在vendor/assets顺便说一句。
  • 它工作正常,谢谢!如果你想写出来,我给你一个最佳答案。
  • 顺便说一句,为了我的信息,正确的路径怎么会跳过图像?

标签: css ruby-on-rails twitter-bootstrap glyphicons twitter-bootstrap-2


【解决方案1】:

简而言之,如果您使用Rails assets pipeline,您的所有资产都会被编译到/assets 文件夹中。还有一个选项可以更改文件夹名称。详情请参阅指南。

如果您将scss 与sass-rails gem 一起使用,则有一些辅助方法asset-url and image-url 可以帮助您管理CSS 的资产路径。

最后,您可以使用几个 gem 来在 Rails 应用中包含引导程序:

https://github.com/seyhunak/twitter-bootstrap-rails 是一个less 版本(Bootstrap 是用 less 构建的)。它需要less-rails gem 和https://github.com/thomas-mcdonald/bootstrap-sass

【讨论】:

    猜你喜欢
    • 2016-04-25
    • 2016-12-14
    • 1970-01-01
    • 1970-01-01
    • 2015-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-26
    相关资源
    最近更新 更多