rails / sass-rails

Ruby on Rails stylesheet engine for Sass

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Different precompiled files with same code

agrass opened this issue · comments

When I precompile the same css in two servers I get differents css minimized. I don't know the reason of this issue,I have the same config (config.assets.css_compressor = :sass)

For example one part of the unpacked minimized css in server 1 is like this (the same that the real file) :


.c3-tooltip
{
    border-collapse:collapse;
    border-spacing:0;
    background-color:#fff;
    empty-cells:show;
    -webkit-box-shadow:7px 7px 12px -9px #777;
    -moz-box-shadow:7px 7px 12px -9px #777;
    box-shadow:7px 7px 12px -9px #777; 
    opacity:0.9
}

Then in server 2 I get this (webkit-box-shadow and -moz-box-shadow were removed):


.c3-tooltip
{
    border-collapse:collapse;
    border-spacing:0;
    background-color:#fff;
    empty-cells:show;
    box-shadow:7px 7px 12px -9px #777;
    opacity:0.9
}

how are you getting that info?
Are you doing curl calls to 2 different servers and seeing different results?
Not sure how to simulate this issue, if you could provide a sample app would help out.
thanks

Yes something like that, I have a loadbalancer with different servers and sometimes the stylesheets were not loaded. I checked the names of the css compressed files and in one server have a different fingerprint. Next uncompressing the files with (http://cssunpacker.com/) I realize that one of the servers when compress the css is removing some -webkit, -moz and other syntaxis.

Server 1 and 2 have the same code, the only difference is that one is in a normal EC2 machine with rbenv and the other one is in a stack of OpsWorks without rbenv, both have the same Gemfile.lock

one server I have a different fingerprint

This means that the file content is not the same. Something is generating different files in your server.

If the code is the same and the version of the gems are the same I don't see why sprockets would generate different results. Make sure that your assets folders and dependencies are the same.

Yes, the compressed file in one server remove some lines as shown in the first comment. I just realize that most of the files that have this problem have ".css.scss" extension and files with .sass extension don't have this problem. Could be something related with this? I know that in the latest version of sass-rails the .css.scss extension is deprecated, Its possible that the extenssion cause this issue?

Don't think so. Given the same environment and the same code, I don't see how the files would be different. I'd make sure that the environment is the same in both servers first (gem versions, dependencies versions, assets code)

It's the same code and gem versions. The deploy in both servers use the same branch. In the server with the problem if I check the non precompiled assets It's exactly the same of the other server, but when I compress it, some attributes as shown in the first comment were removed.

Does that code being generated by some gem like compass or bourbon? Seems only the prefix styles are missing, but the box-shadow is there.

No, the only difference are that in the server of the problem I'm using AWS opsworks with some chef recipes and I don't have rbenv configured, It's possible that some of this is cousing this issue? (I use the default recipes of opsworks rails layer). The box-shadow is there in both servers, the compression remove the whole line "-webkit-box-shadow" and "-moz-box-shadow".Thanks, I would really appreciate any help or comments about this issue.

"-webkit-box-shadow" and "-moz-box-shadow"

In our sass code are these properties generated by some kind of mixin?

Like:

@include box-shadow(7px 7px 12px -9px #777);

Not having rbenv configured can be a reason for this yeah, if that means that global gems installed on the machine are affecting your application, but I'd guess bundler would protect you.

not, It's not generated by some kind of mixin, they are in some imports of scss from the application.sass with normal css syntax.

😖 so this is now even more weird. If it is just normal css syntax I can't see how this same file can be different in different servers.

yes is very weird. Finally I give up with this issue and decided to use the gem 'asset_sync' to upload the assets on s3.

RAILS_ENV=production rake assets:precompile on server dropped

  font-family: "ヒラギノ丸ゴ ProN W4", "Hiragino Maru Gothic Pro", "メイリオ", Meiryo, Helvetica, sans-serif
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0)
  -ms-text-size-adjust: 100%
  -webkit-text-size-adjust: 100%

from html section

on local machine not

The same is happening to me my css vendor prefixes are removing in production enviroment but not in my local machine. Here you can get more info http://stackoverflow.com/questions/32179803/rails-removing-css-vendor-prefixes-in-production-enviroment