@vertesia/plugin-builder 0.80.0-dev.20251121 → 0.80.0
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/README.md +119 -0
- package/package.json +10 -8
package/README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# @vertesia/plugin-builder
|
|
2
|
+
|
|
3
|
+
A Vite plugin for building Vertesia UI plugins with CSS handling and Tailwind utilities extraction.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Seamless integration with Vite build process
|
|
8
|
+
- Automatic CSS file generation for plugins
|
|
9
|
+
- Tailwind CSS utilities layer extraction
|
|
10
|
+
- Optional inline CSS as JavaScript export
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @vertesia/plugin-builder --save-dev
|
|
16
|
+
# or
|
|
17
|
+
pnpm add -D @vertesia/plugin-builder
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
Add the plugin to your `vite.config.ts`:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { defineConfig } from 'vite';
|
|
26
|
+
import { vertesiaPluginBuilder } from '@vertesia/plugin-builder';
|
|
27
|
+
|
|
28
|
+
export default defineConfig({
|
|
29
|
+
plugins: [
|
|
30
|
+
vertesiaPluginBuilder()
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Configuration Options
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
interface VertesiaPluginBuilderOptions {
|
|
39
|
+
// Inline CSS as a JavaScript export variable
|
|
40
|
+
inlineCss?: boolean;
|
|
41
|
+
|
|
42
|
+
// Name of the exported CSS variable (default: 'css')
|
|
43
|
+
cssVar?: string;
|
|
44
|
+
|
|
45
|
+
// Input CSS file path (default: 'src/index.css')
|
|
46
|
+
input?: string;
|
|
47
|
+
|
|
48
|
+
// Output CSS file name (default: 'plugin.css')
|
|
49
|
+
output?: string;
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Examples
|
|
54
|
+
|
|
55
|
+
### Basic Usage
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { vertesiaPluginBuilder } from '@vertesia/plugin-builder';
|
|
59
|
+
|
|
60
|
+
export default defineConfig({
|
|
61
|
+
plugins: [
|
|
62
|
+
vertesiaPluginBuilder()
|
|
63
|
+
]
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### With Inline CSS Export
|
|
68
|
+
|
|
69
|
+
When `inlineCss` is enabled, the plugin extracts Tailwind utilities and exports them as a JavaScript variable:
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { vertesiaPluginBuilder } from '@vertesia/plugin-builder';
|
|
73
|
+
|
|
74
|
+
export default defineConfig({
|
|
75
|
+
plugins: [
|
|
76
|
+
vertesiaPluginBuilder({
|
|
77
|
+
inlineCss: true,
|
|
78
|
+
cssVar: 'pluginStyles'
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
This allows you to import the CSS directly in your JavaScript:
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
import { pluginStyles } from './plugin.js';
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Custom Input/Output
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
import { vertesiaPluginBuilder } from '@vertesia/plugin-builder';
|
|
94
|
+
|
|
95
|
+
export default defineConfig({
|
|
96
|
+
plugins: [
|
|
97
|
+
vertesiaPluginBuilder({
|
|
98
|
+
input: 'styles/main.css',
|
|
99
|
+
output: 'my-plugin.css'
|
|
100
|
+
})
|
|
101
|
+
]
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## How It Works
|
|
106
|
+
|
|
107
|
+
1. The plugin creates a virtual entry module that imports your CSS file
|
|
108
|
+
2. During the build process, Vite processes the CSS through its pipeline (including Tailwind if configured)
|
|
109
|
+
3. The processed CSS is output to the specified file
|
|
110
|
+
4. If `inlineCss` is enabled, the Tailwind utilities layer is extracted and appended to the JavaScript bundle as an exported variable
|
|
111
|
+
|
|
112
|
+
## Requirements
|
|
113
|
+
|
|
114
|
+
- Vite 4.2.0 or higher
|
|
115
|
+
- Node.js 18+
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
Apache-2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertesia/plugin-builder",
|
|
3
|
-
"version": "0.80.0
|
|
3
|
+
"version": "0.80.0",
|
|
4
4
|
"description": "A vite plugin to build vertesia UI plugins",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -9,15 +9,17 @@
|
|
|
9
9
|
"lib",
|
|
10
10
|
"src"
|
|
11
11
|
],
|
|
12
|
-
"license": "
|
|
12
|
+
"license": "Apache-2.0",
|
|
13
13
|
"homepage": "https://docs.vertesiahq.com",
|
|
14
14
|
"keywords": [
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"react"
|
|
15
|
+
"vertesia",
|
|
16
|
+
"plugin",
|
|
17
|
+
"vite",
|
|
18
|
+
"vite-plugin",
|
|
19
|
+
"ui",
|
|
20
|
+
"react",
|
|
21
|
+
"css",
|
|
22
|
+
"tailwind"
|
|
21
23
|
],
|
|
22
24
|
"devDependencies": {
|
|
23
25
|
"typescript": "^5.0.2"
|