Prettier-vscode: How do I set different tab size for css and js files?

Created on 29 Aug 2017  路  5Comments  路  Source: prettier/prettier-vscode

I want one tab equals to 2spaces in js files but for css files I want 1tab equal to 4spaces.

locked

Most helpful comment

create a .prettierrc file with

{
    "tabWidth": 2,
    "overrides": [
        {
            "files": "*.css",
            "options": {
                "tabWidth": 4
            }
        }
    ]
}

All 5 comments

create a .prettierrc file with

{
    "tabWidth": 2,
    "overrides": [
        {
            "files": "*.css",
            "options": {
                "tabWidth": 4
            }
        }
    ]
}

@CiGit Is there anyway to create global .rc file instead of .rc file in each project?

Sort of
Create it at /.prettierrc.
keep in mind it will read the first encountered .prettierrc upwards
Or if you keep all your projects in /Users/me/Projects create /Users/me/Projects/.prettierrc

There is no concept of project. Only a file system tree

Ok, that works. thanks @CiGit !

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bardware picture bardware  路  4Comments

studiojms picture studiojms  路  4Comments

SkeLLLa picture SkeLLLa  路  4Comments

FlorianWendelborn picture FlorianWendelborn  路  3Comments

Tanmccuin picture Tanmccuin  路  3Comments