Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit 78d43f2

Browse files
committed
Include backwards compatibility for sass-rails version 3
1 parent a4b6359 commit 78d43f2

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

app/helpers/requirejs_helper.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
require "requirejs/rails/view_proxy"
33

44
module RequirejsHelper
5+
if defined?(Sass::Rails::VERSION)
6+
sass_rails_version_pattern = Regexp.new("\\A(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\z")
7+
8+
SASS_RAILS_3_COMPATIBILITY = sass_rails_version_pattern.match(Sass::Rails::VERSION)[1].to_i < 4
9+
else
10+
SASS_RAILS_3_COMPATIBILITY = false
11+
end
12+
513
# EXPERIMENTAL: Additional priority settings appended to
614
# any user-specified priority setting by requirejs_include_tag.
715
# Used for JS test suite integration.
@@ -79,7 +87,11 @@ def requirejs_include_tag(name = nil, &block)
7987

8088
def javascript_path(source, options = {})
8189
if defined?(super)
82-
super
90+
if !SASS_RAILS_3_COMPATIBILITY
91+
super
92+
else
93+
super(source)
94+
end
8395
else
8496
view_proxy.javascript_path(source, options)
8597
end

0 commit comments

Comments
 (0)