Source maps in Ruby on Rails through sprockets

☆樱花仙子☆ 提交于 2019-12-02 17:30:39

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!