update sass safelist in viteconfig
This commit is contained in:
parent
c358bd37f7
commit
5fe0eecbce
3 changed files with 31 additions and 20 deletions
22
resources/ts/utilities/sass-safelist.ts
Normal file
22
resources/ts/utilities/sass-safelist.ts
Normal file
|
|
@ -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 };
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue