简体   繁体   English

Rails 4-如何使用bootstrap-sass最后加载打印样式表

[英]Rails 4 - how to load print style sheet last with bootstrap-sass

I have a rails app at 4.1.5. 我在4.1.5上有一个Rails应用程序。 There are some score sheet pages which need printing and which need to printed at an exact font size and td border thickness (thin). 有些计分表页面需要打印,并且需要以准确的字体大小和td边框厚度(薄)打印。 I am using the bootstrap-sass gem. 我正在使用bootstrap-sass宝石。

I have just updated my code to bootstrap 3 and now find that bootstrap is interfering with my score sheet css. 我刚刚将代码更新为bootstrap 3,现在发现bootstrap正在干扰我的成绩单CSS。 What is my best strategy? 我最好的策略是什么?

  1. Place my scoresheet css file in either lib/assets or vendor/assets. 将我的成绩单css文件放在lib / assets或vendor / assets中。 I have read that there is a descending load order with vendor/assets loaded last but can't confirm if that's true. 我已经读到有一个降序加载顺序,最后加载了供应商/资产,但是无法确认是否正确。

  2. Put my score sheet css (or sass) into my bootstrap overrides css after the @import bootstrap directive. 在@import bootstrap指令后,将我的分数表CSS(或sass)放到我的bootstrap覆盖中的css中。

  3. Remove require_tree from my application.css and require each file explicitly in order. 从我的application.css中删除require_tree,并按顺序显式要求每个文件。 I understand require_tree will load files in random order. 我了解require_tree会以随机顺序加载文件。

  4. None of the above? 以上都不是?

require_tree will load alphabetically. require_tree将按字母顺序加载。 You could prefix each file with a number, but that's not my recommendation. 您可以在每个文件前面加上一个数字,但这不是我的建议。

You can explicitly require files, then follow that with a require_tree , which is a catch-all for the rest, which I recommend. 您可以明确要求文件,然后require_tree一个require_tree ,这是其余所有内容的统筹,我建议。

Regarding order, if you want to affect all sass variable based items such as font-size across the entire site: 关于顺序,如果要影响整个站点上所有基于sass变量的项目,例如字体大小,请执行以下操作:

  1. declare values for matching variables (see bootstrap/variables.scss) 声明匹配变量的值(请参阅bootstrap / variables.scss)
  2. import bootstrap 导入引导程序
  3. require specifics, then catch-all with require_tree 需要细节,然后用require_tree全面

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM