compass 使用精灵图@include all-icons-sprites()报错?


在执行@import “icons、/*.png”都好好的,并且生成了精灵图。
但是再执行 @include all-icons-sprites()这一句时就报错了?
图片描述


 /*
NoMethodError: undefined method `parent' for nil:NilClass

Backtrace:
E:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/compass-1.0.3/lib/compass/sass_extensions/functions/sprites.rb:137:in `sprite_does_not_have_parent'
E:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-3.4.14/lib/sass/script/tree/funcall.rb:140:in `_perform'
E:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-3.4.14/lib/sass/script/tree/node.rb:50:in `perform'
E:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-3.4.14/lib/sass/tree/visitors/perform.rb:297:in `visit_if'
E:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-3.4.14/lib/sass/tree/visitors/base.rb:36:in `visit'
E:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-3.4.14/lib/sass/tree/visitors/perform.rb:158:in `block in visit'
E:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-3.4.14/lib/sass/stack.rb:79:in `block in with_base'
E:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-3.4.14/lib/sass/stack.rb:115:in `with_frame'

compass sass web前端开发

Dēvīl﹖ 9 years, 11 months ago

加上“@import "compass/utilities/sprites";”试试

你有本事开门呀 answered 9 years, 11 months ago

有方法没定义或者没写对吧

undefined method `parent' for nil:NilClass

铃兰田D人偶 answered 9 years, 11 months ago

我也遇到这个问题,如果你解决了求回复

westl answered 9 years, 11 months ago

Your Answer