将注释添加到 SASS/Compass 输出
有没有一种方便的方法让 SASS 自动在每个 CSS 输出文件的开头添加注释?具体来说,当使用 Compass 时,我想贴一个简短的警告,告诉设计师不要直接编辑 CSS,并向他们指示如何开始使用 Compass。我使用 :compressed
输出样式,它会删除输入 SCSS/SASS 文件中的注释。
如果没有方便的方法来执行此操作,那么我将提交问题/补丁。我正在考虑添加一个名为 :output_prefix 的 选项
接受一个字符串,该字符串将被添加到所有输出 CSS 文件的前面。
Is there a convenient way to have SASS automatically prepend a comment to the beginning of each CSS output file? Specifically, when using Compasss I'd like to stick a brief warning telling designers not to edit the CSS directly and to point them to instructions on getting started with Compass. I use an output style of :compressed
, which strips out comments that are in the input SCSS/SASS file.
If there isn't a convenient way to do this then I'll submit an issue/patch. I was thinking of adding an option named :output_prefix
that takes a String that will be prepended to all output CSS files.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
来自评论上的 SASS 参考:
所以你可以用这样的东西开始你的 SASS 文件:
From the SASS reference on comments:
So you could start your SASS file with something like this:
压缩删除所有评论。我建议您将其放入属性中:
关于提议的补丁,我认为这个用例没有足够的说服力来保证这样的功能。
compressed strips out all comments. I suggest you put this in a property:
Regarding the proposed patch, I do not think this use case is compelling enough to warrant such a feature.
Sass 中的已知错误。在 master 中已修复但尚未发布:
https://github.com/nex3/sass/issues/784
Known bug in Sass. Fixed in master but not yet released:
https://github.com/nex3/sass/issues/784