Skip to content

Commit

Permalink
feat: support css / less / scss
Browse files Browse the repository at this point in the history
  • Loading branch information
PerfectPan committed Nov 13, 2022
1 parent 36f6221 commit 45fea18
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This plugin is powered by [prettier](https://github.com/prettier/prettier).

## Supported language

JavaScript, TypeScript, HTML
JavaScript, TypeScript, HTML, CSS, Less, SCSS

## Usage

Expand Down
15 changes: 14 additions & 1 deletion src/language-map.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import parserBabel from 'prettier/parser-babel';
import parserTypeScript from 'prettier/parser-typescript';
import parserHTML from 'prettier/parser-html';
import parserCSS from 'prettier/parser-postcss';

export type SupportedLanguage = 'js' | 'javascript' | 'ts' | 'typescript' | 'html';
export type SupportedLanguage = 'js' | 'javascript' | 'ts' | 'typescript' | 'html' | 'css' | 'less' | 'scss';

interface IPrettierOption {
parser: string;
Expand Down Expand Up @@ -30,4 +31,16 @@ export const languageMap: Record<SupportedLanguage, IPrettierOption> = {
parser: 'html',
plugins: [parserHTML]
},
css: {
parser: 'css',
plugins: [parserCSS]
},
less: {
parser: 'css',
plugins: [parserCSS]
},
scss: {
parser: 'css',
plugins: [parserCSS]
},
}

0 comments on commit 45fea18

Please sign in to comment.