在 less css 中转义整个声明
是否有可能逃脱整个声明? 这在 less.js 中符合要求(我正在使用 less.app),
margin: e(" 0 10px");
但这会引发错误:
e("margin: 0 10px");
我尝试将“margin”放入变量中,但没有成功。
Is it possible to escape whole declaration?
This complies fine in less.js (I'm using less.app)
margin: e(" 0 10px");
But this throws an error:
e("margin: 0 10px");
I've tried putting 'margin' in a variable but without success.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
抱歉,这是不可能的。但有几点:
官方转义名称(根据 lesscss.org 是波形符引号,而不是
e ()
语法,如下所示:其次,您提供的代码不够复杂,无法保证 LESS CSS 字符串文字。请分享您遇到问题的实际代码。可能想结束这个问题并询问另一个问题。
第三,请记住,您可以包含 .css 文件 - 它不会被编译,只是转储到输出中。语法与标准 CSS 导入相同:
Sorry that's not possible. A couple things though:
The official escape designation (according to lesscss.org is the tilde-quote, not the
e()
syntax, like so:Second, the code you provided is not nearly complex enough to warrant a LESS CSS string literal. Please share the actual code that you are having trouble with. You may want to close this question and ask another one.
Third, remember that you can include a .css file - it will not be compiled, just dumped into the output. The syntax is identical to a standard CSS import:
经过多次尝试,我将其编译并输出到我的 less 文件中。
这是 IE object-fit 的一个 hack(我从 object-fit
After many attempts, I got this to compile and output in my less file.
This is a hack for IE object-fit (I got that idea from object-fit