diff --git a/resources/ts/libs/.gitkeep b/resources/ts/libs/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/resources/ts/utilities/sass-safelist.ts b/resources/ts/utilities/sass-safelist.ts new file mode 100644 index 0000000..3132981 --- /dev/null +++ b/resources/ts/utilities/sass-safelist.ts @@ -0,0 +1,22 @@ +const sassSafelist = [ + // Bootstrap + /^cropper-/, + /^offcanvas-/, + /^tooltip/, + /^bs-tooltip/, + /^data-popper/, + /.*\[data-popper-placement].*/, + /^bs-popover/, + /^popover/, + /^bg-.*/, + // Vue + /-(leave|enter|appear)(|-(to|from|active))$/, + /^(?!(|.*?:)cursor-move).+-move$/, + /^router-link(|-exact)-active$/, + /data-v-.*/, + // Cookies + /^cn-.*/, + // Other + /^text-bubble-.*/, +]; +export { sassSafelist }; diff --git a/vite.config.ts b/vite.config.ts index 85e06c4..996a07f 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,32 +6,15 @@ import laravel from "laravel-vite-plugin"; import path from "path"; import postcssDiscard from "postcss-discard-comments"; import copy from "rollup-plugin-copy"; -import { ConfigEnv, UserConfig, defineConfig, loadEnv } from "vite"; +import { defineConfig, loadEnv } from "vite"; import babel from "vite-plugin-babel"; import checker from "vite-plugin-checker"; import eslint from "vite-plugin-eslint"; import stylelint from "vite-plugin-stylelint"; +import { sassSafelist } from "./resources/ts/utilities/sass-safelist"; const env = loadEnv("r", process.cwd(), ""); -const purgePlugin = purge({ - templates: ["blade"], - paths: [ - "resources/{js,ts,views}/**/*.{ts,js,vue}" - ], - safelist: [ - // Bootstrap - /^cropper-/, /^offcanvas-/, /^tooltip/, /^bs-tooltip/, /^data-popper/, /.*\[data-popper-placement].*/, - /^bs-popover/, /^popover/, - // Vue - /-(leave|enter|appear)(|-(to|from|active))$/, /^(?!(|.*?:)cursor-move).+-move$/, /^router-link(|-exact)-active$/, /data-v-.*/, - // Cookies - /^cn-.*/ - ], -}); - -purgePlugin.apply = (config: UserConfig, env: ConfigEnv) => env.mode === "production"; - export default defineConfig({ build: { rollupOptions: { @@ -159,7 +142,13 @@ export default defineConfig({ isProduction: process.env.NODE_ENV !== "local" ? true : false, exclude: ["node_modules", "vendor"], }), - purgePlugin + purge({ + templates: ["blade"], + paths: [ + "resources/{js,ts,views}/**/*.{ts,js,vue}" + ], + safelist: sassSafelist, + }) ], server: { https: true,