CSS single property auto-indent in VSCODE

6 days ago 8
ARTICLE AD BOX

How to configure VScode to keep CSS rules with only one property on a single line when autoformatting? Here is the expected result :

.p-auto { padding: auto !important; } .px-0 { padding-left: 0 !important; padding-right: 0 !important; }

I already tryed a lot of things :

css-on-line extension => Set all rules on one line (even the long multiple properties ones)

Install Prettier => I've never been able to configure the expected behavior

Install Beautify css/sass/scss/less => I've never been able to configure the expected behavior

Install Prettier with /* prettier-ignore */ => You have to report this comment for each line

I read this : https://github.com/prettier/prettier/issues/5948 (the best ressource I found, but no working solution)

I read this : Beautify in VS Code: Is there a way to use single-line formatting for styles with one property, but multi-line for styles with multiple properties? (zero answer / zero comment)

I didn't find any option to prevent formatting in a block of code

I didn't find any option to prevent formatting a file

Any idea ?

Read Entire Article