@gustcss/vite 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +136 -0
- package/package.json +5 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kumasuke
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# @gustcss/vite
|
|
2
|
+
|
|
3
|
+
Vite plugin for [GustCSS](https://www.npmjs.com/package/gustcss) - Lightning-fast CSS utility generator.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install gustcss @gustcss/vite
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Basic Setup
|
|
14
|
+
|
|
15
|
+
In your `vite.config.js` or `vite.config.ts`:
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
import { defineConfig } from 'vite'
|
|
19
|
+
import gustcss from '@gustcss/vite'
|
|
20
|
+
|
|
21
|
+
export default defineConfig({
|
|
22
|
+
plugins: [
|
|
23
|
+
gustcss({
|
|
24
|
+
output: 'src/styles/utility.css',
|
|
25
|
+
}),
|
|
26
|
+
],
|
|
27
|
+
})
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Import Generated CSS
|
|
31
|
+
|
|
32
|
+
In your main entry file (e.g., `src/main.js`):
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
import './styles/utility.css'
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Configuration
|
|
39
|
+
|
|
40
|
+
#### Using Plugin Options
|
|
41
|
+
|
|
42
|
+
```javascript
|
|
43
|
+
export default defineConfig({
|
|
44
|
+
plugins: [
|
|
45
|
+
gustcss({
|
|
46
|
+
content: ['./src/**/*.{js,ts,jsx,tsx,vue,astro}'],
|
|
47
|
+
output: 'src/styles/utility.css',
|
|
48
|
+
config: './gustcss.config.json', // Optional: path to config file
|
|
49
|
+
}),
|
|
50
|
+
],
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### Using Config File
|
|
55
|
+
|
|
56
|
+
Create `gustcss.config.json` in your project root:
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"content": ["./src/**/*.{js,ts,jsx,tsx,vue,astro}"],
|
|
61
|
+
"output": "src/styles/utility.css",
|
|
62
|
+
"darkMode": "class",
|
|
63
|
+
"theme": {
|
|
64
|
+
"extend": {
|
|
65
|
+
"colors": {
|
|
66
|
+
"brand": "#3B82F6"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Features
|
|
74
|
+
|
|
75
|
+
### ⚡️ Development Mode
|
|
76
|
+
|
|
77
|
+
- Watches your source files for changes
|
|
78
|
+
- Regenerates CSS automatically
|
|
79
|
+
- Hot Module Replacement (HMR) support
|
|
80
|
+
|
|
81
|
+
### 🚀 Production Build
|
|
82
|
+
|
|
83
|
+
- Generates optimized CSS at build time
|
|
84
|
+
- Only includes utilities used in your code
|
|
85
|
+
- No runtime overhead
|
|
86
|
+
|
|
87
|
+
## How It Works
|
|
88
|
+
|
|
89
|
+
1. The plugin scans files specified in the `content` array
|
|
90
|
+
2. Extracts utility class names from your code
|
|
91
|
+
3. Generates CSS for those utilities on-demand
|
|
92
|
+
4. Outputs to the specified CSS file
|
|
93
|
+
5. Watches for changes in development mode
|
|
94
|
+
|
|
95
|
+
## Framework Support
|
|
96
|
+
|
|
97
|
+
Works with all Vite-supported frameworks:
|
|
98
|
+
|
|
99
|
+
- ⚛️ React
|
|
100
|
+
- 🖖 Vue
|
|
101
|
+
- 🔺 Astro
|
|
102
|
+
- 💎 Solid
|
|
103
|
+
- 🔥 Svelte
|
|
104
|
+
- 📦 Vanilla JS
|
|
105
|
+
|
|
106
|
+
## Example
|
|
107
|
+
|
|
108
|
+
**Input** (your component):
|
|
109
|
+
```jsx
|
|
110
|
+
<div className="p-4 bg-blue-500 text-white rounded-lg hover:bg-blue-600">
|
|
111
|
+
Hello GustCSS!
|
|
112
|
+
</div>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Output** (`src/styles/utility.css`):
|
|
116
|
+
```css
|
|
117
|
+
.p-4 { padding: 1rem; }
|
|
118
|
+
.bg-blue-500 { background-color: #3b82f6; }
|
|
119
|
+
.text-white { color: #ffffff; }
|
|
120
|
+
.rounded-lg { border-radius: 0.5rem; }
|
|
121
|
+
.hover\:bg-blue-600:hover { background-color: #2563eb; }
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Requirements
|
|
125
|
+
|
|
126
|
+
- Node.js >= 18.0.0
|
|
127
|
+
- Vite ^4.0.0 || ^5.0.0 || ^6.0.0
|
|
128
|
+
|
|
129
|
+
## Related Packages
|
|
130
|
+
|
|
131
|
+
- [gustcss](https://www.npmjs.com/package/gustcss) - CLI tool
|
|
132
|
+
- [@gustcss/postcss](https://www.npmjs.com/package/@gustcss/postcss) - PostCSS plugin
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gustcss/vite",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Vite plugin for
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Vite plugin for GustCSS",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"module": "index.mjs",
|
|
7
7
|
"type": "module",
|
|
@@ -22,9 +22,10 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"gustcss": "^0.1.
|
|
25
|
+
"gustcss": "^0.1.1"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"vite": "^4.0.0 || ^5.0.0 || ^6.0.0"
|
|
29
|
-
}
|
|
29
|
+
},
|
|
30
|
+
"license": "MIT"
|
|
30
31
|
}
|