Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我最近决定使用RTLCSS来制作我的样式表的 RTL 版本。现在我正在尝试使用声明级指令来告诉 RTLCSS 做什么,但是 SASS 将我的评论编译到下一行。
例如,font-size: 14px/*rtl:15px*/;编译为
font-size: 14px/*rtl:15px*/;
font-size: 14px; /*rtl:15px*/
这会阻止 RTLCSS 正确处理它。有没有解决的办法?我可以将 sass 配置为按原样编译值,保留注释位置吗?
PS 我使用 grunt-sass(node-sass) 来处理我的 scss 文件。
使用 SASS插值语法,将您的评论作为字符串传递
body{ font-size: 14px #{"/*rtl:15px*/"}; }
会产生
body { font-size: 14px /*rtl:15px*/; }
支持标准 / rtl:... / 和特殊/重要 / !rtl:... / 符号。
您可以使用/!rtl:来逃避 sass 编译器
文档