From 82884348cb1b424a4c4452ef734bc4e760926b2f Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Sat, 10 Aug 2024 00:52:23 +0800 Subject: feat(fmt): support CSS, SCSS, Sass and Less (#24870) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR integrates [Malva](https://github.com/g-plane/malva) into `deno fmt`, which introduces the ability to format CSS, SCSS, Sass and Less files. On Linux x64 6.10, this PR increases about 800KiB: ``` ❯ wc -c target/release/deno 125168728 target/release/deno ❯ wc -c target/release/deno 124349456 target/release/deno ``` --- tests/testdata/fmt/badly_formatted.css | 2 ++ tests/testdata/fmt/badly_formatted.md | 6 +++++- tests/testdata/fmt/badly_formatted_fixed.css | 3 +++ tests/testdata/fmt/badly_formatted_fixed.md | 6 ++++++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/testdata/fmt/badly_formatted.css create mode 100644 tests/testdata/fmt/badly_formatted_fixed.css (limited to 'tests/testdata/fmt') diff --git a/tests/testdata/fmt/badly_formatted.css b/tests/testdata/fmt/badly_formatted.css new file mode 100644 index 000000000..bfe18b821 --- /dev/null +++ b/tests/testdata/fmt/badly_formatted.css @@ -0,0 +1,2 @@ +#app>.btn{ color : #000 } + diff --git a/tests/testdata/fmt/badly_formatted.md b/tests/testdata/fmt/badly_formatted.md index 05a4b2f97..29d73b365 100644 --- a/tests/testdata/fmt/badly_formatted.md +++ b/tests/testdata/fmt/badly_formatted.md @@ -32,7 +32,7 @@ function foo(): number { { // Comment in JSON "key": "value", - "key2": + "key2": "value2", } @@ -49,3 +49,7 @@ function foo(): number { - item1 - item2 ``` + +```css +#app>.btn{ color : #000 } +``` diff --git a/tests/testdata/fmt/badly_formatted_fixed.css b/tests/testdata/fmt/badly_formatted_fixed.css new file mode 100644 index 000000000..1653551f4 --- /dev/null +++ b/tests/testdata/fmt/badly_formatted_fixed.css @@ -0,0 +1,3 @@ +#app > .btn { + color: #000; +} diff --git a/tests/testdata/fmt/badly_formatted_fixed.md b/tests/testdata/fmt/badly_formatted_fixed.md index 7a7d1913b..db2afc809 100644 --- a/tests/testdata/fmt/badly_formatted_fixed.md +++ b/tests/testdata/fmt/badly_formatted_fixed.md @@ -40,3 +40,9 @@ function foo(): number { - item1 - item2 ``` + +```css +#app > .btn { + color: #000; +} +``` -- cgit v1.2.3