Getting sprockets compiled assets in an extension

How can I get the rendered version of a javascript file an extension or middleman console ?

For example, this is what I’m getting now:

> res = sitemap.find_resource_by_path( path )
> res.render( layout: false )
 => "//= require jquery\n//= require bootstrap-sprockets\n//= require react\n//= require react_ujs\n//= require './api'\n//= require_tree './components'\n" 

And I want to have the actual javascript that is generated. (I’m passing this to a javascript engine to do prerendering…)

OK, so the answer is:

resource = app.sprockets[path]
rendered_js = resource.source

That took way to long to figure out!