Skip to content

Commit 3807d8a

Browse files
Update purgeCss to whitelist data-bs-theme attribute (#3262)
1 parent 4096d7d commit 3807d8a

4 files changed

Lines changed: 18 additions & 4 deletions

File tree

packages/app-web/vite.config.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import { defineConfig } from "vite";
33
import purgeCss from "vite-plugin-purgecss";
44
import svgr from "vite-plugin-svgr";
55
import { CURSORLESS_ORG_URL } from "@cursorless/lib-common";
6-
import { viteHtmlParams, vitePreactAlias } from "@cursorless/lib-common/vite";
6+
import {
7+
viteHtmlParams,
8+
vitePreactAlias,
9+
purgeCssOptions,
10+
} from "@cursorless/lib-common/vite";
711
import {
812
DESCRIPTION,
913
TITLE,
@@ -33,7 +37,7 @@ export default defineConfig((): UserConfig => {
3337
},
3438

3539
plugins: [
36-
purgeCss({}),
40+
purgeCss(purgeCssOptions),
3741
svgr(),
3842
viteHtmlParams({
3943
CURSORLESS_ORG_URL,

packages/lib-cheatsheet-local/vite.config.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import type { UserConfig } from "vite";
33
import purgeCss from "vite-plugin-purgecss";
44
import { viteSingleFile } from "vite-plugin-singlefile";
55
import defaultCheatsheetInfo from "@cursorless/lib-cheatsheet/defaultSpokenForms";
6-
import { viteHtmlParams, vitePreactAlias } from "@cursorless/lib-common/vite";
6+
import {
7+
purgeCssOptions,
8+
viteHtmlParams,
9+
vitePreactAlias,
10+
} from "@cursorless/lib-common/vite";
711

812
export default defineConfig((): UserConfig => {
913
return {
@@ -16,7 +20,7 @@ export default defineConfig((): UserConfig => {
1620
},
1721

1822
plugins: [
19-
purgeCss({}),
23+
purgeCss(purgeCssOptions),
2024
viteSingleFile(),
2125
viteHtmlParams({
2226
FAKE_CHEATSHEET_INFO: JSON.stringify(defaultCheatsheetInfo),
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const purgeCssOptions = {
2+
safelist: {
3+
greedy: [/data-bs-theme/],
4+
},
5+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from "./viteHtmlParamsPlugin";
22
export * from "./vitePreactAlias";
3+
export * from "./purgeCssOptions";

0 commit comments

Comments
 (0)