Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ralfebert/37ec9f065cf495e97c67 to your computer and use it in GitHub Desktop.
Save ralfebert/37ec9f065cf495e97c67 to your computer and use it in GitHub Desktop.
From 5366b677f1f7a1053de5904f96ba5108ffaf8953 Mon Sep 17 00:00:00 2001
From: Ralf Ebert <info@ralfebert.de>
Date: Thu, 7 May 2015 23:33:01 +0200
Subject: [PATCH] Fix for #844: Incompatibility haml (4.0.6) -> sprockets
(3.0.3) causing error 'wrong number of arguments' for inline :sass filter in
haml template
---
lib/haml/sass_rails_filter.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/haml/sass_rails_filter.rb b/lib/haml/sass_rails_filter.rb
index 9d3ef29..4b488a0 100644
--- a/lib/haml/sass_rails_filter.rb
+++ b/lib/haml/sass_rails_filter.rb
@@ -4,7 +4,7 @@ module Haml
# Rails's asset helpers to be used inside Haml Sass filter.
class SassRailsTemplate < ::Sass::Rails::SassTemplate
def render(scope=Object.new, locals={}, &block)
- scope = ::Rails.application.assets.context_class.new(::Rails.application.assets, "/", "/")
+ scope = ::Rails.application.assets.context_class.new({environment: ::Rails.application.assets, logical_path: "/", filename: "/", metadata: {}})
super
end
--
2.3.0
# Monkey Patch for
# https://github.com/haml/haml/issues/844
# Incompatibility haml (4.0.6) -> sprockets (3.0.3) causing error 'wrong number of arguments' for inline :sass filter in haml template
module Haml
module Filters
# This is an extension of Sass::Rails's SassTemplate class that allows
# Rails's asset helpers to be used inside Haml Sass filter.
class SassRailsTemplate
def render(scope=Object.new, locals={}, &block)
binding.pry
scope = ::Rails.application.assets.context_class.new({environment: ::Rails.application.assets, logical_path: "/", filename: "/", metadata: {}})
super
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment