【问题标题】:Sass (Ruby CSS compressor) absolute path parameters on WindowsWindows 上的 Sass(Ruby CSS 压缩器)绝对路径参数
【发布时间】:2011-03-29 09:53:26
【问题描述】:

我正在使用sass(来自haml-edge)处理css 文件,它作为参数在绝对路径上崩溃:

K:\sass>sass.bat k:/sass/css/*.scss k:/sass/css/*.css --trace
d:/Programs/Ruby/lib/ruby/gems/1.9.1/gems/haml-edge-3.1.62/lib/sass/files.rb:23:in `read': No such file or directory - k
 (Errno::ENOENT)
    from d:/Programs/Ruby/lib/ruby/gems/1.9.1/gems/haml-edge-3.1.62/lib/sass/files.rb:23:in `tree_for'
    from d:/Programs/Ruby/lib/ruby/gems/1.9.1/gems/haml-edge-3.1.62/lib/sass/plugin.rb:220:in `update_stylesheet'
    from d:/Programs/Ruby/lib/ruby/gems/1.9.1/gems/haml-edge-3.1.62/lib/sass/plugin.rb:71:in `block in update_stylesheets'
    from d:/Programs/Ruby/lib/ruby/gems/1.9.1/gems/haml-edge-3.1.62/lib/sass/plugin.rb:71:in `each'
    from d:/Programs/Ruby/lib/ruby/gems/1.9.1/gems/haml-edge-3.1.62/lib/sass/plugin.rb:71:in `update_stylesheets'
    from d:/Programs/Ruby/lib/ruby/gems/1.9.1/gems/haml-edge-3.1.62/lib/haml/exec.rb:433:in `watch_or_update'
    from d:/Programs/Ruby/lib/ruby/gems/1.9.1/gems/haml-edge-3.1.62/lib/haml/exec.rb:349:in `process_result'
    from d:/Programs/Ruby/lib/ruby/gems/1.9.1/gems/haml-edge-3.1.62/lib/haml/exec.rb:41:in `parse'
    from d:/Programs/Ruby/lib/ruby/gems/1.9.1/gems/haml-edge-3.1.62/lib/haml/exec.rb:21:in `parse!'
    from d:/Programs/Ruby/lib/ruby/gems/1.9.1/gems/haml-edge-3.1.62/bin/sass:8:in `<top (required)>'
    from d:/Programs/Ruby/bin/sass:19:in `load'
    from d:/Programs/Ruby/bin/sass:19:in `<main>'

我能够通过在split_colon_path (Ruby\lib\ruby\gems\1.9.1\gems\haml-edge-3.1.62\lib\haml\exec.rb) 中注释一个条件来使其工作:

def split_colon_path(path)
  one, two = path.split(':', 2)
  if one && two && #### this part was commented #  ::Haml::Util.windows? &&
      one =~ /\A[A-Za-z]\Z/ && two =~ /\A[\/\\]/
    # If we're on Windows and we were passed a drive letter path,
    # don't split on that colon.
    one2, two = two.split(':', 2)
    one = one + ':' + one2
  end
  return one, two
end

有没有更好的平台检测解决方案?

【问题讨论】:

  • sass vs k:/ssas/ -- 你的路径名的第一个元素是错字吗?
  • @sarnold:替换实际路径时的小错字

标签: css windows ruby sass absolute-path


【解决方案1】:

这是一个已知的错误。它已在 Sass 的最新稳定版本中修复,除非您使用的是 mingw Ruby,在这种情况下,它将在下一个稳定版本(将于本周末发布)中修复。

【讨论】:

    【解决方案2】:

    问题已在haml-edge 3.1.64 中解决。

    作为记录,mingw 已添加到{Ruby folder}\lib\ruby\gems\1.9.1\gems\haml-edge-3.1.64\lib\haml\util.rb 中的host_os 可能值:

    # Whether or not this is running on Windows.
    #
    # @return [Boolean]
    def windows?
      RbConfig::CONFIG['host_os'] =~ /mswin|windows|mingw/i
    end
    

    【讨论】:

    • 感谢您的解释。看起来你是在公共互联网索引上解释这个错误的人:)
    猜你喜欢
    • 2011-04-20
    • 2012-01-01
    • 2018-12-27
    • 1970-01-01
    • 2021-12-12
    • 1970-01-01
    • 2016-01-07
    • 2016-09-12
    • 1970-01-01
    相关资源
    最近更新 更多