Referral chain:
Don't know why but for me it helped to put into assets.rb this line
Rails.application.config.assets.precompile += [/^[-_a-zA-Z0-9]*\..*/]
Initially I had the Sass::SyntaxError: Undefined variable: "$alert-padding". problem with this line
Rails.application.config.assets.precompile += [/.*\.css/]
But after I changed it to the first one the problem was solved and everything worked in production.