错误用罗盘编译css资产

时间:2012-07-29 11:31:46

标签: ruby-on-rails compass-sass sass

嗨我想用罗盘转换以下内容,虽然我收到一个编译错误,声明'未定义的mixin background-image'

#header_toolbar {
height: 40px;
/* The black toolbar gradient :) */
background: #313131; /* Old browsers */
@include background-image(linear-gradient(left top, #313131, #101010));
/*background: -moz-linear-gradient(top,  #313131 0%, #101010 100%); *//* FF3.6+ *//*
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#313131), color-stop(100%,#101010)); *//* Chrome,Safari4+ *//*
background: -webkit-linear-gradient(top,  #313131 0%,#101010 100%); *//* Chrome10+,Safari5.1+ *//*
background: -o-linear-gradient(top,  #313131 0%,#101010 100%); *//* Opera 11.10+ *//*
background: -ms-linear-gradient(top,  #313131 0%,#101010 100%); *//* IE10+ *//*
background: linear-gradient(top,  #313131 0%,#101010 100%); *//* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#313131', endColorstr='#101010',GradientType=0 ); /* IE6-9 */

}

gemfile

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platform => :ruby

  gem 'uglifier', '>= 1.0.3'
  gem 'compass-rails'
  gem "compass", "~> 0.12.1"
end

1 个答案:

答案 0 :(得分:2)

您需要在scss中导入mixin:

 @import "compass/css3/images"

http://compass-style.org/reference/compass/css3/images/

在这里查看有关在一个地方获取导入的想法,而不是在每个scss文件中定义它们:http://compass-style.org/help/tutorials/best_practices/