开发者

ActiveSupport can't load Sass engine under Rails 2.3.4

开发者 https://www.devze.com 2023-02-13 09:44 出处:网络
I\'m trying to use Sass engine in a controller like in this blog post. But Rails (2.3.4) ActiveSupport can\'t load it because of an error:

I'm trying to use Sass engine in a controller like in this blog post. But Rails (2.3.4) ActiveSupport can't load it because of an error:

ArgumentError (Anonymous modules have no name to be referenced by):
  haml (3.0.25) lib/sass/script/color.rb:19
  haml (3.0.25) lib/sass/script/literal.rb:10
  haml (3.0.25) lib/sass/script/string.rb:1
  haml (3.0.25) lib/sass/script/operation.rb:2
  haml (3.0.25) lib/sass/script.rb:5
  haml (3.0.25) lib/sass/engine.rb:22
  app/controllers/stylesheets_controller.rb:1

Here's 开发者_如何学JAVAthe code in Sass::Script::Color

class << self; include Haml::Util; end

I've tried with the latest Haml version and also version 2.2.24 with the same result. Is there a compatible version? Is there a problem on my side?


Finally it was quite stupid, the Sass::Script::Color file wasn't requiring Haml::Util, so I had to do it myself:

require 'haml/util'
require 'sass/engine'
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号