@see-ms/converter 0.1.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 +283 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +489 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.d.mts +45 -0
- package/dist/index.mjs +486 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
# @see-ms/converter
|
|
2
|
+
|
|
3
|
+
CLI tool for converting HTML exports to Nuxt 3 projects with automatic CMS integration.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
✨ **Automatic Conversion**
|
|
8
|
+
- Convert HTML to Vue components
|
|
9
|
+
- Transform `<a>` tags to `<NuxtLink>` with proper routing
|
|
10
|
+
- Normalize all asset paths automatically
|
|
11
|
+
|
|
12
|
+
🎨 **Asset Management**
|
|
13
|
+
- CSS files → `assets/css/`
|
|
14
|
+
- Images, fonts, JS → `public/assets/`
|
|
15
|
+
- Auto-generate Vite plugin for path resolution (For Webflow)
|
|
16
|
+
|
|
17
|
+
🔧 **Smart Transforms**
|
|
18
|
+
- Extract and deduplicate embedded styles
|
|
19
|
+
- Remove unnecessary attributes (srcset, sizes)
|
|
20
|
+
- Clean up script tags and inline code
|
|
21
|
+
- Format output with Prettier
|
|
22
|
+
|
|
23
|
+
📦 **Boilerplate Support**
|
|
24
|
+
- Clone from GitHub repository
|
|
25
|
+
- Copy from local directory
|
|
26
|
+
- Works with your custom Nuxt boilerplate
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
### Quick Use (npx - no installation)
|
|
33
|
+
```bash
|
|
34
|
+
npx @see-ms/converter convert <webflow-export> <output-dir> [options]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Global Installation
|
|
38
|
+
```bash
|
|
39
|
+
npm install -g @see-ms/converter
|
|
40
|
+
# or
|
|
41
|
+
pnpm add -g @see-ms/converter
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Then use anywhere:
|
|
45
|
+
```bash
|
|
46
|
+
cms convert <webflow-export> <output-dir> [options]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Usage
|
|
52
|
+
|
|
53
|
+
### Basic Conversion
|
|
54
|
+
```bash
|
|
55
|
+
cms convert ./my-webflow-export ./my-nuxt-site
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### With Boilerplate (Recommended)
|
|
59
|
+
```bash
|
|
60
|
+
# From GitHub
|
|
61
|
+
cms convert ./webflow-export ./nuxt-site \
|
|
62
|
+
--boilerplate git@github.com:username/nuxt-boilerplate.git
|
|
63
|
+
|
|
64
|
+
# From local directory
|
|
65
|
+
cms convert ./webflow-export ./nuxt-site \
|
|
66
|
+
--boilerplate /path/to/local/boilerplate
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Full Example
|
|
70
|
+
```bash
|
|
71
|
+
cms convert ./jagal.webflow ./jagal-nuxt \
|
|
72
|
+
--boilerplate git@github.com:Check-DC/customer-boilerplate.git \
|
|
73
|
+
--cms strapi
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Options
|
|
79
|
+
|
|
80
|
+
| Option | Description | Default |
|
|
81
|
+
|--------|-------------|---------|
|
|
82
|
+
| `-b, --boilerplate <source>` | GitHub URL or local path to Nuxt boilerplate | none |
|
|
83
|
+
| `-o, --overrides <path>` | Path to overrides JSON file | none |
|
|
84
|
+
| `--generate-schemas` | Generate CMS schemas after conversion | false |
|
|
85
|
+
| `--cms <type>` | CMS type: strapi, contentful, or sanity | strapi |
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## What Gets Converted
|
|
90
|
+
|
|
91
|
+
### HTML → Vue Components
|
|
92
|
+
|
|
93
|
+
**Before (Webflow):**
|
|
94
|
+
```html
|
|
95
|
+
<!-- index.html -->
|
|
96
|
+
<a href="about.html">About</a>
|
|
97
|
+
<img src="images/logo.svg" srcset="..." sizes="...">
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**After (Nuxt):**
|
|
101
|
+
```vue
|
|
102
|
+
<!-- pages/index.vue -->
|
|
103
|
+
<script setup lang="ts">
|
|
104
|
+
// Page: index
|
|
105
|
+
</script>
|
|
106
|
+
|
|
107
|
+
<template>
|
|
108
|
+
<div class="page-index">
|
|
109
|
+
<NuxtLink to="/about">About</NuxtLink>
|
|
110
|
+
<img src="/assets/images/logo.svg">
|
|
111
|
+
</div>
|
|
112
|
+
</template>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Asset Structure
|
|
116
|
+
```
|
|
117
|
+
webflow-export/ nuxt-project/
|
|
118
|
+
├── css/ → ├── assets/css/
|
|
119
|
+
├── images/ → ├── public/assets/images/
|
|
120
|
+
├── fonts/ → ├── public/assets/fonts/
|
|
121
|
+
├── js/ → ├── public/assets/js/
|
|
122
|
+
└── *.html → └── pages/*.vue
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Auto-Generated Files
|
|
126
|
+
|
|
127
|
+
- ✅ `utils/webflow-assets.ts` - Vite plugin for CSS path resolution on Webflow files
|
|
128
|
+
- ✅ `assets/css/main.css` - Extracted embedded styles
|
|
129
|
+
- ✅ Updated `nuxt.config.ts` with CSS imports
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Transformations Applied
|
|
134
|
+
|
|
135
|
+
### Links
|
|
136
|
+
- `<a href="about.html">` → `<NuxtLink to="/about">`
|
|
137
|
+
- `<a href="../index.html">` → `<NuxtLink to="/">`
|
|
138
|
+
- `<a href="index.html">` → `<NuxtLink to="/">`
|
|
139
|
+
- External links remain as `<a>` tags
|
|
140
|
+
|
|
141
|
+
### Images
|
|
142
|
+
- `images/logo.svg` → `/assets/images/logo.svg`
|
|
143
|
+
- Removes `srcset` and `sizes` attributes
|
|
144
|
+
- Normalizes relative paths
|
|
145
|
+
|
|
146
|
+
### Styles
|
|
147
|
+
- Extracts `.global-embed` styles (For Webflow)
|
|
148
|
+
- Deduplicates repeated styles
|
|
149
|
+
- Adds to `assets/css/main.css`
|
|
150
|
+
|
|
151
|
+
### Scripts
|
|
152
|
+
- Removes all inline `<script>` tags
|
|
153
|
+
- Cleans up Webflow-specific JavaScript
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Output Structure
|
|
158
|
+
```
|
|
159
|
+
my-nuxt-site/
|
|
160
|
+
├── pages/
|
|
161
|
+
│ ├── index.vue
|
|
162
|
+
│ └── others.cue
|
|
163
|
+
│
|
|
164
|
+
├── assets/
|
|
165
|
+
│ └── css/
|
|
166
|
+
│ ├── normalize.css
|
|
167
|
+
│ ├── components.css
|
|
168
|
+
│ ├── webflow.css
|
|
169
|
+
│ └── main.css
|
|
170
|
+
├── public/
|
|
171
|
+
│ └── assets/
|
|
172
|
+
│ ├── images/
|
|
173
|
+
│ ├── fonts/
|
|
174
|
+
│ └── js/
|
|
175
|
+
├── utils/
|
|
176
|
+
│ └── webflow-assets.ts
|
|
177
|
+
└── nuxt.config.ts (updated)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## After Conversion
|
|
183
|
+
|
|
184
|
+
1. **Install dependencies:**
|
|
185
|
+
```bash
|
|
186
|
+
cd my-nuxt-site
|
|
187
|
+
pnpm install
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
2. **Start development server:**
|
|
191
|
+
```bash
|
|
192
|
+
pnpm dev
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
3. **Your site should be running!** 🎉
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Requirements
|
|
200
|
+
|
|
201
|
+
- Node.js >= 18
|
|
202
|
+
- A Webflow export (HTML, CSS, images, fonts)
|
|
203
|
+
- (Optional) A Nuxt 3 boilerplate
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Tips
|
|
208
|
+
|
|
209
|
+
### Using Your Own Boilerplate
|
|
210
|
+
|
|
211
|
+
If you have a standard Nuxt boilerplate for all projects:
|
|
212
|
+
|
|
213
|
+
1. Create a GitHub repo with your boilerplate
|
|
214
|
+
2. Use it in every conversion:
|
|
215
|
+
```bash
|
|
216
|
+
cms convert ./webflow ./output --boilerplate git@github.com:you/boilerplate.git
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Webflow Export Tips
|
|
220
|
+
|
|
221
|
+
- Export from Webflow: **Site Settings → Export Code**
|
|
222
|
+
- Make sure to include all assets
|
|
223
|
+
- Check that images are properly linked
|
|
224
|
+
|
|
225
|
+
### Handling Custom Code
|
|
226
|
+
|
|
227
|
+
If your Webflow site has custom JavaScript that you need:
|
|
228
|
+
1. The converter removes inline scripts for clean Vue components
|
|
229
|
+
2. Port necessary JavaScript to Vue composables or plugins
|
|
230
|
+
3. Add to your Nuxt `plugins/` or `composables/` folders
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Troubleshooting
|
|
235
|
+
|
|
236
|
+
### `nuxt.config.ts not found`
|
|
237
|
+
|
|
238
|
+
The converter expects a `nuxt.config.ts` file. Either:
|
|
239
|
+
- Use a boilerplate that has one, or
|
|
240
|
+
- The converter will create a minimal one if no boilerplate is specified
|
|
241
|
+
|
|
242
|
+
### Assets not loading
|
|
243
|
+
|
|
244
|
+
Make sure the `webflow-assets.ts` plugin is imported in your `nuxt.config.ts`:
|
|
245
|
+
```typescript
|
|
246
|
+
import webflowAssets from './utils/webflow-assets'
|
|
247
|
+
|
|
248
|
+
export default defineNuxtConfig({
|
|
249
|
+
vite: {
|
|
250
|
+
plugins: [webflowAssets()]
|
|
251
|
+
}
|
|
252
|
+
})
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Routes not working
|
|
256
|
+
|
|
257
|
+
Check that your `pages/` directory is enabled in Nuxt. It should be automatic, but verify in `nuxt.config.ts`:
|
|
258
|
+
```typescript
|
|
259
|
+
export default defineNuxtConfig({
|
|
260
|
+
pages: true
|
|
261
|
+
})
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Contributing
|
|
267
|
+
|
|
268
|
+
Issues and pull requests welcome!
|
|
269
|
+
|
|
270
|
+
## License
|
|
271
|
+
|
|
272
|
+
MIT
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Related Packages
|
|
277
|
+
|
|
278
|
+
- [@see-ms/types](../types) - Shared TypeScript types
|
|
279
|
+
- [@see-ms/editor-overlay](../editor-overlay) - Inline CMS editor (coming soon)
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
**Made with ❤**
|
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|