Skip to content

Commit

Permalink
Use Compiler#source_map() for generating source maps
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Oct 30, 2013
1 parent 1d694c6 commit cffc2d1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/opal/sprockets/processor.rb
Expand Up @@ -69,10 +69,8 @@ def evaluate(context, locals, &block)
:arity_check => self.class.arity_check_enabled,
:const_missing => self.class.const_missing_enabled,
:dynamic_require_severity => self.class.dynamic_require_severity,
:source_map_enabled => self.class.source_map_enabled,
:irb => self.class.irb_enabled,
:file => context.logical_path,
:source_file => context.pathname.to_s
}

compiler = Opal::Compiler.new
Expand All @@ -84,8 +82,8 @@ def evaluate(context, locals, &block)
context.require_asset path
end

if options[:source_map_enabled]
$OPAL_SOURCE_MAPS[context.pathname] = Opal::SourceMap.new(compiler.fragments, source_file_url(context)).to_s
if self.class.source_map_enabled
$OPAL_SOURCE_MAPS[context.pathname] = compiler.source_map(source_file_url(context)).to_s
"#{result}\n//@ sourceMappingURL=#{source_map_url(context)}\n"
else
result
Expand Down

0 comments on commit cffc2d1

Please sign in to comment.