https://github.com/guoyunhe/vite-plugin-package-style
Vite plugin to automatically import styles from packages
https://github.com/guoyunhe/vite-plugin-package-style
Last synced: 6 months ago
JSON representation
Vite plugin to automatically import styles from packages
- Host: GitHub
- URL: https://github.com/guoyunhe/vite-plugin-package-style
- Owner: guoyunhe
- License: mit
- Created: 2023-02-28T07:34:56.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-29T09:21:05.000Z (almost 2 years ago)
- Last Synced: 2024-11-15T10:48:50.203Z (7 months ago)
- Language: TypeScript
- Size: 36.1 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# vite-plugin-package-style
Vite plugin to automatically import styles from packages
## Install
```bash
npm i -D vite-plugin-package-style
```## Usage
```ts
// vite.config.ts
import { defineConfig } from 'vite';
import packageStyle from 'vite-plugin-package-style';export default defineConfig({
plugins: [
packageStyle({
rules: [
{
include: ['foobar', '@foo/*'],
exclude: ['@foo/bar-*'],
resolveStyle: (pkg) => {
return `${pkg}/dist/index.css`;
},
},
],
}),
],
});
```