Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exclude css files from auto formatting in IntelliJ

We're using the auto formatting feature of IntelliJ to format our code whenever a commit to git is made.

The formatting works well for us except for our designer who's not happy with the way how IntelliJ formats his CSS files. Is there a way to deactivate auto formatting for certain file types?

like image 937
Flo Avatar asked Dec 27 '22 00:12

Flo


2 Answers

Since IDEA 13 it is possible to deactivate formatting with

/* @formatter:off */

and reactivate with

/* @formatter:on */

But you need to enable that first in Settings -> Code Style -> General -> Formatter Control

like image 171
Jörg Pfründer Avatar answered Jan 13 '23 14:01

Jörg Pfründer


You can also right-click on a file and choose "Mark as Plain Text". When reformatting (Ctrl+Alt+L) these files are then excluded.

This also works in IntelliJ 12.

like image 34
Mark Avatar answered Jan 13 '23 13:01

Mark