Source maps in Ruby on Rails through sprockets Source maps in Ruby on Rails through sprockets ruby-on-rails ruby-on-rails

Source maps in Ruby on Rails through sprockets


Rails 4 does not have source maps either.

As far as I know, and as of today, this will only be part of rails 5.

A really nice approach to solve this right now is implemented in discourse by @SamSaffron and explained here:https://github.com/discourse/discourse/blob/master/lib/tasks/assets.rake

The gist, add a "before" task to the sprockets precompile process, and hack into the compilation process to generate the sourcemapped files and directives.

The nice thing in this approach is that you don't lose stuff from files that are both js and erb (*.js.erb) which is something quite common in rails.

I think that patching the whole sprockets pipeline is a bit of an abuse and risky.