SASS:保留评论位置
SASS: preserve comment position
我最近决定使用 RTLCSS 制作我的样式表的 RTL 版本。
现在我正在尝试使用 声明级指令 来告诉 RTLCSS 要做什么,但是 SASS 将我的注释编译到下一行。
例如,font-size: 14px/*rtl:15px*/;
编译为
font-size: 14px;
/*rtl:15px*/
这会阻止 RTLCSS 正确处理它。有没有解决的办法?我可以将 sass 配置为按原样编译值,保留注释位置吗?
P.S。我使用 grunt-sass(node-sass) 来处理我的 scss 文件。
使用 SASS interpolation 语法,将您的评论作为字符串传递
body{ font-size: 14px #{"/*rtl:15px*/"}; }
会产生
body { font-size: 14px /*rtl:15px*/; }
Both standard /rtl:.../ and special/important /!rtl:.../ notations are supported.
您可以使用 /!rtl: 来逃避 sass 编译器
我最近决定使用 RTLCSS 制作我的样式表的 RTL 版本。 现在我正在尝试使用 声明级指令 来告诉 RTLCSS 要做什么,但是 SASS 将我的注释编译到下一行。
例如,font-size: 14px/*rtl:15px*/;
编译为
font-size: 14px;
/*rtl:15px*/
这会阻止 RTLCSS 正确处理它。有没有解决的办法?我可以将 sass 配置为按原样编译值,保留注释位置吗?
P.S。我使用 grunt-sass(node-sass) 来处理我的 scss 文件。
使用 SASS interpolation 语法,将您的评论作为字符串传递
body{ font-size: 14px #{"/*rtl:15px*/"}; }
会产生
body { font-size: 14px /*rtl:15px*/; }
Both standard /rtl:.../ and special/important /!rtl:.../ notations are supported.
您可以使用 /!rtl: 来逃避 sass 编译器