Source maps in Ruby on Rails through sprockets

前端 未结 1 1707
深忆病人
深忆病人 2021-01-31 16:49

I\'d like to add source map support on a rails 3.2 application I am working on. As far as I know, generating source maps is not supported by Sprockets and from its github page i

相关标签:
1条回答
  • 2021-01-31 17:34

    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.

    0 讨论(0)
提交回复
热议问题