4

我在用

@include keyframes(small) {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

.small {
  @include animation(small 1s infinite);
}

Rails 给了我以下错误:

Sass::SyntaxError at /
Undefined mixin 'keyframes'. (or 'animation')

我正在使用最新的 SASS 和 compass --pre (alpha),它应该支持动画。

4

2 回答 2

0

以下 gemfile 更新应该可以做到...

# compass 1.0 needed to use keyframe mixin
# but compass 1.0 needs Sass 3.3 (further below)
gem "compass", "~> 1.0" 
gem 'compass-rails'

# use sass-rails ~>5.0 to get Sass ~>3.3 
# needed for compass ~>1.0 
# which is needed for keyframes mixin
gem 'sass-rails', "~>5.0"
于 2015-02-11T13:44:50.197 回答
0

尝试在 GemFile 中使用以下 gem 组合:

gem "sass", "~> 3.2.19"
gem 'sass-rails', '~> 4.0.4'
gem "compass", "~> 0.12.7"
gem 'compass-rails', '~> 2.0.0'

然后确保在 scss 文件的顶部有以下几行:

@import "compass";
@import "compass/css3";
于 2014-11-19T16:05:07.283 回答