Bootstrap-sass > ie_hex_str not interpreted during assets precompilation

254 views Asked by At

I run into a quite strange issue :

I'm working with :

  • Rails 3.1.1
  • Bootstrap-sass 1.4.4 (didn't have time to upgrade to 2.0 yet)

An known issue in previous bootstrap-sass 1.4.0 was the one described here relating to IE gradients displays. This was fixed in 1.4.3 by the introduction (from what I understood) of ie_hex_str function and specific filters for IE like :

filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie_hex_str($startColor)}', endColorstr='#{ie_hex_str($endColor)}', GradientType=0);

Some details are given here.

I still have the problem and my issue is that after the assets precompilation I get something like :

filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='ie_hex_str(#FFFFFE)', endColorstr='ie_hex_str(#E6E6E6)', GradientType=0);

That is the ie_hex_str was not interpreted when compiling the assets. I didn't touch any of the bootstrap-sass code so I don't understand what's going on...

Any idea ?

UPDATE :

The "funny" thing is that I have 2 applications using the same versions of rails and bootstrap-sass and doing pretty much the same thing and they don't react the same way. For one the ie_hex_str is correctly interpreted.

2

There are 2 answers

0
Maximilien Moulin On BEST ANSWER

I couldn't find out what was going on. It seems that the functions in the sass mixins of bootstrap-sass are not getting interpreted during assets precompilation.

As I couldn't figure out why, I used a workaround: I overrode the definitions I'm using such as btn :

.btn {
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#FFFFFFFE, endColorstr=#FFE6E6E6, GradientType=0);

  .primary {
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#FF049CDB, endColorstr=#FF0064CD, GradientType=0);
  }
}

Using the color I need. At least it works well.

0
Rob DiCiuccio On

The problem appears to be caused by the asset pipeline initialize_on_precompile setting in application.rb (Rails 3.1):

config.assets.initialize_on_precompile = false

The "ie_hex_str" precompile issue appeared for us when including this line in application.rb. Removing/commenting resolved the issue.

  • Rails 3.1.3
  • bootstrap-sass 1.4.4