SASS: How to remove /*# sourceMappingURL Comment

99封情书 提交于 2019-12-21 09:07:20

问题


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

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

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

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.

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)


回答1:


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.

Your command will look something like this:

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


来源:https://stackoverflow.com/questions/27145368/sass-how-to-remove-sourcemappingurl-comment

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