https://github.com/bang9/vite-plugin-styled-components-minify
A Vite plugin to minify styled-components template literals
https://github.com/bang9/vite-plugin-styled-components-minify
minify plugin styled-components vite vite-plugin-styled-components
Last synced: 3 months ago
JSON representation
A Vite plugin to minify styled-components template literals
- Host: GitHub
- URL: https://github.com/bang9/vite-plugin-styled-components-minify
- Owner: bang9
- License: mit
- Created: 2025-01-24T05:35:50.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-08T16:28:44.000Z (about 1 year ago)
- Last Synced: 2025-10-25T01:27:35.666Z (7 months ago)
- Topics: minify, plugin, styled-components, vite, vite-plugin-styled-components
- Language: TypeScript
- Homepage:
- Size: 24.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vite-plugin-styled-components-minify
A Vite plugin to minify `styled-components` template literals.
## Installation
Install the plugin using your package manager of choice:
```sh
pnpm add -D vite-plugin-styled-components-minify
```
## Usage
Add the plugin to your Vite configuration:
```typescript
// vite.config.ts
import { defineConfig } from 'vite';
import viteStyledComponentsMinify from 'vite-plugin-styled-components-minify';
export default defineConfig({
plugins: [viteStyledComponentsMinify()],
});
```
## Example
Before minification:
```typescript
import styled from 'styled-components';
const Button = styled.button`
color: red;
background: blue;
`;
```
After minification:
```typescript
import styled from 'styled-components';
const Button = styled.button`color:red;background:blue;`;
```
## Tests
Run the tests using Vitest:
```sh
pnpm test
```
## License
This project is licensed under the MIT License.