简体   繁体   中英

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

I have a rails app at 4.1.5. There are some score sheet pages which need printing and which need to printed at an exact font size and td border thickness (thin). I am using the bootstrap-sass gem.

I have just updated my code to bootstrap 3 and now find that bootstrap is interfering with my score sheet css. What is my best strategy?

  1. Place my scoresheet css file in either lib/assets or 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.

  3. Remove require_tree from my application.css and require each file explicitly in order. I understand require_tree will load files in random order.

  4. None of the above?

require_tree will load alphabetically. 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.

Regarding order, if you want to affect all sass variable based items such as font-size across the entire site:

  1. declare values for matching variables (see bootstrap/variables.scss)
  2. import bootstrap
  3. require specifics, then catch-all with require_tree

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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