使用Compass watch在Non-Rails项目中挂起

时间:2014-08-06 10:48:45

标签: configuration config compass-sass watch compass-rails

我使用罗盘与非Rails项目。我有一个配置文件:

config/compass.rb

我的配置文件如下所示:

http_path = "/"
css_dir = "./example"
sass_dir = "./example/sass"
images_dir = "./example/images"
javascripts_dir = "./example/js"

output_style = :compressed
relative_assets = true

我正在使用以下方式启动Compass:

compass watch -c config/compass.rb

当我运行时,指南针就会挂起。如果我使用--trace运行罗盘并退出,我会得到以下堆栈跟踪:

^CInterrupt on line ["18"] of /Users/me/.gem/ruby/2.0.0/gems/compass-rails-2.0.0/lib/compass-rails.rb:
  /Users/me/.gem/ruby/2.0.0/gems/compass-rails-2.0.0/lib/compass-rails.rb:116:in `configuration'
  /Users/me/.gem/ruby/2.0.0/gems/compass-1.0.0.rc.1/lib/compass/configuration/helpers.rb:21:in `configuration_for'
  /Users/me/.gem/ruby/2.0.0/gems/compass-core-1.0.0.rc.1/lib/compass/configuration.rb:139:in `add_configuration'
  /Users/me/.gem/ruby/2.0.0/gems/compass-1.0.0.rc.1/lib/compass/configuration/helpers.rb:79:in `add_project_configuration'
  /Users/me/.gem/ruby/2.0.0/gems/compass-1.0.0.rc.1/lib/compass/commands/project_base.rb:37:in `add_project_configuration'
  /Users/me/.gem/ruby/2.0.0/gems/compass-1.0.0.rc.1/lib/compass/commands/project_base.rb:25:in `configure!'
  /Users/me/.gem/ruby/2.0.0/gems/compass-1.0.0.rc.1/lib/compass/commands/project_base.rb:15:in `initialize'
  /Users/me/.gem/ruby/2.0.0/gems/compass-1.0.0.rc.1/lib/compass/commands/update_project.rb:41:in `initialize'

因此看来,调用compass而不是使用compass watch gem,而是compass-rails正在使用$ which compass,它需要我不提供和挂起的配置参数。

/Users/me/.gem/ruby/2.0.0/bin/compass返回:{{1}}

为什么会这样,我该如何解决?

1 个答案:

答案 0 :(得分:0)

为了实现这个目的,我使用了Bundler并运行了:

$ be compass watch -c ./config/compass.rb

注意bebundle exec的别名。

我仍然不确定compass-rails是如何挂钩compass的。