Search code examples
cssintellij-ideaformattingcode-formatting

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?


Solution

  • 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

    Later versions of IntelliJ offer the setting in Settings -> Editor -> Code Style -> Formatter