I'm trying VS Code for a few days and I've installed csscomb extension. It works fine when I put .csscomb.json
on my work directory.
But I wish it worked even on file I open outside of my work directory.
Could you tell me how to configure VS Code and/or csscomb to work like this? I use Windows 10 Pro.
According to the csscomb page on VS Code's Marketplace...
They have "Supported settings"
And the following warning:
In other words, since there is no default, you have to set either a preset config or path to a custom config.
To configure csscomb in VS Code:
Enter the path to your custom config or choose a preset
OR one of ("csscomb", "zen", "yandex")
Next, you need to create the
.csscomb.json
file in that location. I chose the C:\Users\username\.vscode directory because that's where VS Code also downloads extensions on Windows.Here's the config I created using csscomb's config generator:
You can also include an option for sorting tags (or copy it from one of their presets on git):
Now you should be able to format CSS within VS Code by typing
ctrl+shift+p
then typing "CSScomb" thenenter
."Formatter" extensions are supposed to be recognized by the default formatting keyboard shortcut
shift+alt+f
, however I haven't gotten that to work. I think it's something the developer has to configure.Instead, you can create your own keyboard shortcut in VS Code:
keybindings.json
Add your custom keybinding
Now you should be all set!