[英]How can I disable Visual Studio Code auto trimming whitespace of my HTML classes?
<ul{{attributes.addClass('container container-desktop')}}>
when I press Command + / (autoformat), all my classes are without whitespace:当我按Command + / (自动格式化)时,我所有的类都没有空格:
<ul{{attributes.addClass('containercontainer-desktop')}}>
I searched in the settings of Visual Studio Code for a setting.我在 Visual Studio Code 的设置中搜索了一个设置。 But did not found a solution to disable it.
但是没有找到禁用它的解决方案。
That's a correct behavior from your IDE, because addClass
with a string parameter is meant to add one class .这是 IDE 的正确行为,因为带有字符串参数的
addClass
意味着添加一个 class 。
For multiple classes, refer to this documentation :对于多个类,请参阅此文档:
{% set classes = [ 'red', 'green', ] %} <div{{ attributes.addClass(classes) }}></div>
Try this and see if it solves the problem for you.试试这个,看看它是否能解决你的问题。
Open Visual Studio Code and:打开 Visual Studio Code 并:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.