Skip to content

Commit 09f73da

Browse files
danielpclarkrmm5t
authored andcommitted
Support new SassImporter method signature
Fixes #195
1 parent eccebfa commit 09f73da

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*.gem
22
*.rbc
33
.bundle
4+
.idea
45
.config
56
.yardoc
67
gemfiles/*.gemfile.lock

lib/compass-rails/patches/sass_importer.rb

+10-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
klass.class_eval do
88
def evaluate(context, locals, &block)
99
# Use custom importer that knows about Sprockets Caching
10-
cache_store = Sprockets::SassCacheStore.new(context.environment)
10+
cache_store = begin Sprockets::SassCacheStore.new(context.environment); rescue; nil; end ||
11+
Sprockets::SassCacheStore.new(context.environment, "1")
1112
paths = context.environment.paths.map { |path| CompassRails::SpriteImporter.new(context, path) }
12-
paths += context.environment.paths.map { |path| self.class.parent::SassImporter.new(context, path) }
13+
paths += context.environment.paths.map { |path| sass_importer(context, path) }
1314
paths += ::Rails.application.config.sass.load_paths
1415

1516

@@ -18,7 +19,7 @@ def evaluate(context, locals, &block)
1819
:line => line,
1920
:syntax => syntax,
2021
:cache_store => cache_store,
21-
:importer => self.class.parent::SassImporter.new(context, context.pathname),
22+
:importer => sass_importer(context, context.pathname),
2223
:load_paths => paths,
2324
:sprockets => {
2425
:context => context,
@@ -32,5 +33,11 @@ def evaluate(context, locals, &block)
3233
context.__LINE__ = e.sass_backtrace.first[:line]
3334
raise e
3435
end
36+
37+
private
38+
def sass_importer(context, path)
39+
begin self.class.parent::SassImporter.new(context, path); rescue; nil; end ||
40+
self.class.parent::SassImporter.new(path)
41+
end
3542
end
3643

0 commit comments

Comments
 (0)