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: about 2 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 (4 months ago)
- Default Branch: main
- Last Pushed: 2025-01-24T07:15:39.000Z (4 months ago)
- Last Synced: 2025-03-15T01:56:18.385Z (about 2 months ago)
- Topics: minify, plugin, styled-components, vite, vite-plugin-styled-components
- Language: TypeScript
- Homepage:
- Size: 22.5 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.