Skip to content

Commit 45fea18

Browse files
committed
feat: support css / less / scss
1 parent 36f6221 commit 45fea18

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This plugin is powered by [prettier](https://github.com/prettier/prettier).
66

77
## Supported language
88

9-
JavaScript, TypeScript, HTML
9+
JavaScript, TypeScript, HTML, CSS, Less, SCSS
1010

1111
## Usage
1212

src/language-map.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import parserBabel from 'prettier/parser-babel';
22
import parserTypeScript from 'prettier/parser-typescript';
33
import parserHTML from 'prettier/parser-html';
4+
import parserCSS from 'prettier/parser-postcss';
45

5-
export type SupportedLanguage = 'js' | 'javascript' | 'ts' | 'typescript' | 'html';
6+
export type SupportedLanguage = 'js' | 'javascript' | 'ts' | 'typescript' | 'html' | 'css' | 'less' | 'scss';
67

78
interface IPrettierOption {
89
parser: string;
@@ -30,4 +31,16 @@ export const languageMap: Record<SupportedLanguage, IPrettierOption> = {
3031
parser: 'html',
3132
plugins: [parserHTML]
3233
},
34+
css: {
35+
parser: 'css',
36+
plugins: [parserCSS]
37+
},
38+
less: {
39+
parser: 'css',
40+
plugins: [parserCSS]
41+
},
42+
scss: {
43+
parser: 'css',
44+
plugins: [parserCSS]
45+
},
3346
}

0 commit comments

Comments
 (0)