0
<ul{{attributes.addClass('container container-desktop')}}>

when I press Command + / (autoformat), all my classes are without whitespace:

<ul{{attributes.addClass('containercontainer-desktop')}}>

I searched in the settings of Visual Studio Code for a setting. But did not found a solution to disable it.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Slowwie
  • 1,146
  • 2
  • 20
  • 36

2 Answers2

2

That's a correct behavior from your IDE, because addClass with a string parameter is meant to add one class.

For multiple classes, refer to this documentation:

{%
  set classes = [
    'red',
    'green',
  ]
%}
<div{{ attributes.addClass(classes) }}></div>
technophyle
  • 7,972
  • 6
  • 29
  • 50
-1

Try this and see if it solves the problem for you.

Open Visual Studio Code and:

  • Click menu FilePreferences → *Settings.
  • Click {} at the top
  • It leads you to a settings.json file were you'll add: "files.trimTrailingWhitespace": true
  • Save your file.
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131