fix purge sass in vite.config.ts
This commit is contained in:
parent
dd7639c803
commit
1d55d19fb9
2 changed files with 13 additions and 9 deletions
|
|
@ -1,4 +1,6 @@
|
|||
const sassSafelist = [
|
||||
import type { UserDefinedSafelist } from "purgecss";
|
||||
|
||||
const sassSafelist: UserDefinedSafelist = [
|
||||
// Bootstrap
|
||||
/^cropper-/,
|
||||
/^offcanvas-/,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import laravel from "laravel-vite-plugin";
|
|||
import path from "path";
|
||||
import postcssDiscard from "postcss-discard-comments";
|
||||
import copy from "rollup-plugin-copy";
|
||||
import { defineConfig, loadEnv } from "vite";
|
||||
import { ConfigEnv, UserConfig, defineConfig, loadEnv } from "vite";
|
||||
import babel from "vite-plugin-babel";
|
||||
import checker from "vite-plugin-checker";
|
||||
import eslint from "vite-plugin-eslint";
|
||||
|
|
@ -15,6 +15,14 @@ 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: sassSafelist,
|
||||
});
|
||||
|
||||
purgePlugin.apply = (config: UserConfig, env: ConfigEnv) => env.mode === "production";
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
rollupOptions: {
|
||||
|
|
@ -142,13 +150,7 @@ export default defineConfig({
|
|||
isProduction: process.env.NODE_ENV !== "local" ? true : false,
|
||||
exclude: ["node_modules", "vendor"],
|
||||
}),
|
||||
purge({
|
||||
templates: ["blade"],
|
||||
paths: [
|
||||
"resources/{js,ts,views}/**/*.{ts,js,vue}"
|
||||
],
|
||||
safelist: sassSafelist,
|
||||
})
|
||||
purgePlugin
|
||||
],
|
||||
server: {
|
||||
https: true,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue