Just ran across this trying to figure it out. Since it sounds like
there's no solution, I brewed one up:
in lib/sass_ext.rb:
module Sass
module Constant
APP_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/
sass_constants.yml")[RAILS_ENV]
class << self
def get_constant(value, constants)
to_return = constants[value] || APP_CONFIG[value]
raise SyntaxError.new("Undefined constant: \"!#{value}\"")
unless to_return
to_return
end
end
end
end
in config/environment.rb:
require 'sass_ext'
in config/sass_constants.yml:
development:
host: "localhost:3000"
production:
host: "
example.com"
test:
host: "localhost:3000"
in a .sass file:
:background-image = "url(http://" + !host + "/images/foobar.png)"
I needed something like that so our CSS could be linked remotely and
still work.
-Ian