如何在 rails 4 中为 Sass 启用源映射? [英] How can I enable Source Maps for Sass in rails 4?

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

问题描述

根据这个问题

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

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

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?

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

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

解决方案

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.

Just add it to your Gemfile

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

and add the configuration

# 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:

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

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

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