如何在Rails 4中启用Sass的源地图? [英] How can I enable Source Maps for Sass in rails 4?

查看:46
本文介绍了如何在Rails 4中启用Sass的源地图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据此问题 https://github.com/rails/sass-rails/pull/192
sass-rails尚不支持Sass 3.3.

According to this issue https://github.com/rails/sass-rails/pull/192
sass-rails hasn't support for Sass 3.3 yet.

但是,似乎 sass-rails-source-maps 从一开始就一直依赖于Sass 3.3.那么有没有办法将此宝石与sass-rails一起使用?

But it seems that sass-rails-source-maps has been depending on Sass 3.3 since the very beginning. So is there a way to use this gem with sass-rails?

根据带有sass-rails-source-maps的自述文件,Chrome放弃了对版本低于3.3的Sass的Source Maps文件的支持.

According to the readme with sass-rails-source-maps, Chrome dropped support of the Source Maps files from Sass older than version 3.3.

这是否意味着现在无法通过Chrome devtools使用Sass Source Maps?

Does that mean there is no way of using Sass Source Maps with Chrome devtools now?

推荐答案

sass-rails的替代品有了很大的减少,不仅速度更快,而且可以选择使用内联源地图.

There is a great new drop in replacement for sass-rails, which is not only faster, but also has the option to use inline source-maps.

只需将其添加到您的Gemfile

Just add it to your Gemfile

#gem 'sass-rails', '~> 5.0'
gem 'sassc-rails'

并添加配置

# config/environments/development.rb
config.sass.inline_source_maps = true

别忘了重新启动服务器,那么您应该在检查器中看到它正在工作:

Don't forget to restart your server, then you should see it working in the inspector:

您可以在此处找到该存储库: https://github.com/sass/sassc-rails

You can find the repo here: https://github.com/sass/sassc-rails

这篇关于如何在Rails 4中启用Sass的源地图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆