为什么`中间人服务'工作,但是'中间人构建'无法编译这个Sass?

时间:2013-04-19 00:36:52

标签: ruby sass compass-sass middleman

当我运行middleman进行投放时,all.css编译正常,仅包含对+box-shadow(none)的调用:

/* line 1, /home/yang/asdf/source/stylesheets/content.css.sass */
div {
  -webkit-box-shadow: none;
  -moz-box-shadow: none;
  box-shadow: none; }

但是当我构建网站时,我得到了这个Sass / Compass错误:

$ middleman build
Slim::EmbeddedEngine is deprecated, it is called Slim::Embedded in Slim 2.0
Slim::EmbeddedEngine is deprecated, it is called Slim::Embedded in Slim 2.0
Slim::EmbeddedEngine is deprecated, it is called Slim::Embedded in Slim 2.0
/home/yang/asdf/source/stylesheets/content.css.sass:2:in `box-shadow': Undefined mixin 'box-shadow'. (Sass::SyntaxError)
  (in /home/yang/asdf/source/stylesheets/content.css.sass:2)
        from /home/yang/asdf/source/stylesheets/content.css.sass:2
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/perform.rb:253:in `visit_mixin'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/base.rb:37:in `visit'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/perform.rb:100:in `visit'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/base.rb:53:in `block in visit_children'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/base.rb:53:in `map'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/base.rb:53:in `visit_children'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/perform.rb:109:in `block in visit_children'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/perform.rb:121:in `with_environment'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/perform.rb:108:in `visit_children'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/base.rb:37:in `block in visit'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/perform.rb:320:in `visit_rule'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/base.rb:37:in `visit'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/perform.rb:100:in `visit'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/base.rb:53:in `block in visit_children'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/base.rb:53:in `map'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/base.rb:53:in `visit_children'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/perform.rb:109:in `block in visit_children'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/perform.rb:121:in `with_environment'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/perform.rb:108:in `visit_children'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/base.rb:37:in `block in visit'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/perform.rb:128:in `visit_root'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/base.rb:37:in `visit'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/perform.rb:100:in `visit'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/perform.rb:7:in `visit'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/tree/root_node.rb:20:in `render'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/engine.rb:315:in `_render'
        from /var/lib/gems/1.9.1/gems/sass-3.2.7/lib/sass/engine.rb:262:in `render'
        from /var/lib/gems/1.9.1/gems/sprockets-sass-0.9.1/lib/sprockets/sass/sass_template.rb:40:in `evaluate'
        from /var/lib/gems/1.9.1/gems/tilt-1.3.7/lib/tilt/template.rb:77:in `render'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/context.rb:197:in `block in evaluate'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/context.rb:194:in `each'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/context.rb:194:in `evaluate'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/processed_asset.rb:12:in `initialize'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/base.rb:374:in `new'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/base.rb:374:in `block in build_asset'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/base.rb:395:
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/base.rb:373:in `build_asset'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/index.rb:94:in `block in build_asset'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/caching.rb:51:in `cache_asset'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/index.rb:93:in `build_asset'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/base.rb:287:in `find_asset'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/index.rb:61:in `find_asset'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/bundled_asset.rb:16:in `initialize'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/base.rb:377:in `new'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/base.rb:377:in `build_asset'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/index.rb:94:in `block in build_asset'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/caching.rb:51:in `cache_asset'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/index.rb:93:in `build_asset'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/base.rb:287:in `find_asset'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/index.rb:61:in `find_asset'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/environment.rb:75:in `find_asset'
        from /var/lib/gems/1.9.1/gems/sprockets-2.9.2/lib/sprockets/server.rb:47:in `call'
        from /var/lib/gems/1.9.1/gems/middleman-sprockets-3.0.11/lib/middleman-sprockets/extension.rb:200:in `call'
        from /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:134:in `call'
        from /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/urlmap.rb:64:in `block in call'
        from /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `each'
        from /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `call'
        from /var/lib/gems/1.9.1/gems/middleman-more-3.0.13/lib/middleman-more/extensions/minify_javascript.rb:51:in `call'
        from /var/lib/gems/1.9.1/gems/middleman-more-3.0.13/lib/middleman-more/extensions/minify_css.rb:50:in `call'
        from /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:134:in `call'
        from /var/lib/gems/1.9.1/gems/rack-test-0.6.2/lib/rack/mock_session.rb:30:in `request'
        from /var/lib/gems/1.9.1/gems/rack-test-0.6.2/lib/rack/test.rb:230:in `process_request'
        from /var/lib/gems/1.9.1/gems/rack-test-0.6.2/lib/rack/test.rb:57:in `get'
        from /var/lib/gems/1.9.1/gems/middleman-core-3.0.13/lib/middleman-core/cli/build.rb:259:in `block in execute!'
        from /var/lib/gems/1.9.1/gems/middleman-core-3.0.13/lib/middleman-core/cli/build.rb:256:in `each'
        from /var/lib/gems/1.9.1/gems/middleman-core-3.0.13/lib/middleman-core/cli/build.rb:256:in `execute!'
        from /var/lib/gems/1.9.1/gems/middleman-core-3.0.13/lib/middleman-core/cli/build.rb:198:in `invoke!'
        from /var/lib/gems/1.9.1/gems/thor-0.15.4/lib/thor/actions.rb:95:in `action'
        from /var/lib/gems/1.9.1/gems/middleman-core-3.0.13/lib/middleman-core/cli/build.rb:65:in `build'
        from /var/lib/gems/1.9.1/gems/thor-0.15.4/lib/thor/task.rb:27:in `run'
        from /var/lib/gems/1.9.1/gems/thor-0.15.4/lib/thor/invocation.rb:120:in `invoke_task'
        from /var/lib/gems/1.9.1/gems/thor-0.15.4/lib/thor.rb:275:in `dispatch'
        from /var/lib/gems/1.9.1/gems/thor-0.15.4/lib/thor/base.rb:425:in `start'
        from /var/lib/gems/1.9.1/gems/middleman-core-3.0.13/lib/middleman-core/cli.rb:77:in `method_missing'
        from /var/lib/gems/1.9.1/gems/thor-0.15.4/lib/thor/task.rb:29:in `run'
        from /var/lib/gems/1.9.1/gems/thor-0.15.4/lib/thor/task.rb:126:in `run'
        from /var/lib/gems/1.9.1/gems/thor-0.15.4/lib/thor/invocation.rb:120:in `invoke_task'
        from /var/lib/gems/1.9.1/gems/thor-0.15.4/lib/thor.rb:275:in `dispatch'
        from /var/lib/gems/1.9.1/gems/thor-0.15.4/lib/thor/base.rb:425:in `start'
        from /var/lib/gems/1.9.1/gems/middleman-core-3.0.13/lib/middleman-core/cli.rb:22:in `start'
        from /var/lib/gems/1.9.1/gems/middleman-core-3.0.13/bin/middleman:18:in `<top (required)>'
        from /usr/local/bin/middleman:19:in `load'
        from /usr/local/bin/middleman:19:in `<main>'

我在下面的一个小例子中重现了这一点,如果你想在本地重新编写,我还在底部包含了base64编码的tar.gz。它还包括完整的回溯。

这是文件树:

asdf
├── config.rb
├── config.ru
├── error
├── Gemfile
├── Gemfile.lock
├── source
│   └── stylesheets
│       ├── all.css.sass
│       └── content.css.sass

以下是所有文件内容:

config.rb:

require 'animate-sass'
require 'susy'
require 'slim'
set :css_dir, 'stylesheets'
set :js_dir, 'javascripts'
set :images_dir, 'images'
set :fonts_dir, 'fonts'
configure :build do
  activate :minify_css
  activate :minify_javascript
  activate :relative_assets
  require "middleman-smusher"
  activate :smusher

config.ru:

require 'rubygems'
require 'middleman/rack'
run Middleman.server

的Gemfile:

source :rubygems
gem "slim"
gem "susy"
gem "animate-sass"
gem "middleman", "~>3.0.13"
gem "middleman-smusher"

Gemfile.lock:见tar.gz

all.css.sass:

@import compass/css3/box-shadow
@import content

content.css.sass:

div
  +box-shadow(none)

这是base64-encodede tar.gz,您可以使用base64 -d进行解码:

H4sIADhQcFEAA+0ca3Mbt1Gf+SsQujOiW/GePFLixJo4juK2Ezsau55+vEJ3oAjrHixwJ0uZTH57
F497UZRFSTzZbrAfbBIL7Au7e7s4iJjHC5swlrO93sABmE4n4n93Frj6f0+OO47nBL6/53quP3EC
x/FhnusGXrCHnP5EaqDkBWYI7V3j7Pxz8+7Cf6PwF5TSOE5IijN0VtIkHrxPaDqfn6RnJI5JfJKd
04wgylFMVoxEuCDxAaKFGIlwkpAYdRcgmskR5FnOV0vLXuYpscWW2lgEAM9LFhGbF9cJ4UtCCm5H
eVaQrLAizi2OOZ97c6Dwn7P8asyXOM4/7c/RhywmCxAjBiNeAXa/hbXQ6L1YNn9/nRX46kSE2PMB
QiOY9yD2YrGCBcvTh9FYI3GJmZ3QM/ucpNx2rSPLVR/F5LFvedZMosVXu2CE2JeU0yJn3F4RtshZ
arGzuRf40jISF0pD7O+MzxnmRDDxZw2P3VFvaeE6Th8cKvm1jc6SPLoQnqiMFS0h4BjpwV6aX4pX
vdHuS4XOphw9jdnaPD1X8vxEi2VIskvK8iyFKOpJwcNebbkWPl079qKR77XiKGRlQkwyMMnAJIM/
ZTJwvbZGLM97CKZvNRm0OOxSA2HkMMtjaRudi8GLYsIeQ5rIalua2w0kzXCXRL2p9xBBVww8GArd
saTuSIykXiEUH/FPWJB0lUCTINhNlFnIJU5KGNqWX0GTYuxavtZBfLXbZGezRynhwaC3Jr+s4K8K
6YZHa2F7X/HvwWmi7I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BgwYMDAVwr/A5doTQIAeAAA

提前感谢您的帮助!

2 个答案:

答案 0 :(得分:14)

原来这是由于某些文件无意输出,其名称不以下划线开头。例如,content.css.sass应为_content.css.sass,以便middleman知道不要尝试直接构建该文件。 (我们并不熟悉middleman等等 - 这是一个交给我们的捆绑包,因此需要一段时间来追踪它。)

答案 1 :(得分:4)

所以我碰到了这个并希望给出一个更准确的答案:

非下划线命名文件下游链中的任何@import ed文件都会出现错误,例如Sass::SyntaxError Undefined VariableUndefined mixin

确保链中的每个文件都以下划线开头一样简单;有时很容易过去!