Skip to content

Commit 6e5cc46

Browse files
committedApr 18, 2015
Sprockets 2 context doesn’t have #filename
Probably pathname can bee used in both cases.
1 parent e388357 commit 6e5cc46

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎lib/opal/sprockets/processor.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def evaluate(context, locals, &block)
7373

7474
# In Sprockets 3 logical_path has an odd behavior when the filename is "index"
7575
# thus we need to bake our own logical_path
76-
logical_path = context.filename.sub(%r{^#{context.root_path}/?(.*?)#{sprockets_extnames_regexp}}, '\1')
76+
filename = context.respond_to?(:filename) ? context.filename : context.pathname.to_s
77+
logical_path = filename.sub(%r{^#{context.root_path}/?(.*?)#{sprockets_extnames_regexp}}, '\1')
7778

7879
compiler_options = self.compiler_options.merge(file: logical_path)
7980

0 commit comments

Comments
 (0)
Please sign in to comment.