Created
July 6, 2022 11:56
-
-
Save Posandu/facad656e5bef48a1129585c8553ac52 to your computer and use it in GitHub Desktop.
Stylify config for React-vite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { defineConfig } from "vite"; | |
import { vitePlugin } from "@stylify/unplugin"; | |
import react from "@vitejs/plugin-react"; | |
const stylifyPlugin = vitePlugin({ | |
transformIncludeFilter: (id) => | |
id.endsWith("js") || | |
id.endsWith("ts") || | |
id.endsWith("tsx") || | |
id.endsWith("jsx"), | |
bundles: [ | |
{ | |
outputFile: "./src/styles/stylify.css", | |
files: ["./src/*.js", "./src/*.ts", "./src/*.jsx", "./src/*.tsx"], | |
}, | |
], | |
extend: { | |
bundler: { | |
compiler: { | |
selectorsAreas: [ | |
'(?:^|\\s+)className="([^"]+)"', | |
"(?:^|\\s+)className='([^']+)'", | |
"(?:^|\\s+)className=\\{`((?:.|\n)+)`\\}", | |
], | |
}, | |
}, | |
}, | |
}); | |
// https://vitejs.dev/config/ | |
export default defineConfig({ | |
plugins: [stylifyPlugin, react()], | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment