SASS:如何删除/ *#sourceMappingURL注释 [英] SASS: How to remove /*# sourceMappingURL Comment

查看:3291
本文介绍了SASS:如何删除/ *#sourceMappingURL注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从Windows命令行启动SASS watch。和FireFox开发工具栏(与显示源)看到的.scss文件。

I'm starting SASS watch from Windows command line. And FireFox developer Toolbar (with Show Sources) to see the .scss files.

一切正常,但我意识到我的最终.css输出文件添加了额外的最后一行例如:

Everything works fine, but I realized my final .css output file was added an extra final line like:

/*# sourceMappingURL=index.css.map */

在我的公司,我不允许留下这个评论我想知道如果我必须手动删除它每次或有任何方式当我停止SASS Watch时自动删除它。

As in my company i'm not allowed to leave this comment I'd like to know If I have to manually remove it everytime or is there any way to automatically remove it when I stop SASS Watch.

问题,除了手动删除行,是我正在使用Git版本控制,所以只是启动SASS(--sass watch ...)将使我的.css文件显示为由GIT修改,因为额外的行被添加(因此它显示在文件中被提交)

Issue, other than the manual removal of the line, is that I'm working with Git for version control, so just by starting SASS (--sass watch...) will make my .css file appear as Modified by GIT as the extra line is added (and therefore it shows up in files to be Committed)

推荐答案

您看到的是 sourcemap ,它将编译的CSS中的CSS类映射到各个SASS文件。自 SASS 3.4 起, sourcemaps默认情况下处于启用状态。要禁用它们,请使用 - sourcemap = none ,该行将不再添加,也不会生成sourcemap。

What you're seeing is the sourcemap, which maps CSS classes in the compiled CSS to the individual SASS files. As of SASS 3.4, sourcemaps are enabled by default. To disable them, use the --sourcemap=none and that line will no longer be added nor will a sourcemap be generated.

您的命令将如下所示:

sass --watch --sourcemap=none path/to/sass:path/to/css

这篇关于SASS:如何删除/ *#sourceMappingURL注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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