|
1 | | -# Forget The Build Step: A Browser-Native Editor For JSX + CSS |
| 1 | +--- |
| 2 | +title: 'Forget The Build Step: A Browser-Native Editor For JSX + CSS' |
| 3 | +published: true |
| 4 | +description: '@knighted/develop is a browser-native editor for JSX and CSS — compile, lint, typecheck, and sync to GitHub without a local build step.' |
| 5 | +tags: javascript, webdev, showdev, react |
| 6 | +--- |
2 | 7 |
|
3 | 8 | Frontend tooling is incredibly capable. |
4 | 9 |
|
5 | 10 | It is also often front-loaded. |
6 | 11 |
|
7 | | -For many UI ideas, the first thing you do is not write code. You install, |
8 | | -configure, and wait. The creative loop starts late. |
| 12 | +For many UI ideas, the first thing you do is not write code. You install, configure, and wait. The creative loop starts late. |
9 | 13 |
|
10 | | -[@knighted/develop](https://github.com/knightedcodemonkey/develop) is built |
11 | | -for a different default: fast prototyping from anywhere you can open a browser. |
| 14 | +[@knighted/develop](https://github.com/knightedcodemonkey/develop) is built for a different default: fast prototyping from anywhere you can open a browser. |
12 | 15 |
|
13 | | -It is a browser-native editor/workbench for |
14 | | -[@knighted/jsx](https://github.com/knightedcodemonkey/jsx) and |
15 | | -[@knighted/css](https://github.com/knightedcodemonkey/css), delivered through |
16 | | -CDN ESM with mode-aware loading. |
| 16 | +It is a browser-native editor/workbench for [@knighted/jsx](https://github.com/knightedcodemonkey/jsx) and [@knighted/css](https://github.com/knightedcodemonkey/css), delivered through CDN ESM with mode-aware loading. |
17 | 17 |
|
18 | 18 | ## The Loop, In Practice |
19 | 19 |
|
20 | | -Open the app, edit multiple files in dynamic tabs, switch render/style modes, |
21 | | -run lint/type diagnostics, and preview instantly. |
| 20 | +Open the app, spin up isolated workspaces, edit multiple files in dynamic tabs, switch render/style modes, run lint/type diagnostics, and preview instantly. |
22 | 21 |
|
23 | 22 | No local bundler is required for that inner loop. |
24 | 23 |
|
| 24 | +In DOM mode, JSX expressions resolve to real DOM nodes — no virtual DOM, no diffing, no reconciler. Tabs are standard ESM modules too, so your entry tab can import from sibling tabs with relative paths: |
| 25 | + |
| 26 | +`App.tsx` |
| 27 | + |
| 28 | +```tsx |
| 29 | +import { Counter } from './Counter.js' |
| 30 | + |
| 31 | +export const App = () => ( |
| 32 | + <main> |
| 33 | + <Counter label="Clicks" /> |
| 34 | + </main> |
| 35 | +) |
| 36 | +``` |
| 37 | + |
| 38 | +`Counter.tsx` |
| 39 | + |
| 40 | +```tsx |
| 41 | +import '../styles/app.css' |
| 42 | + |
| 43 | +type CounterProps = { |
| 44 | + label: string |
| 45 | +} |
| 46 | + |
| 47 | +export const Counter = ({ label }: CounterProps) => { |
| 48 | + const el = ( |
| 49 | + <button class="counter-button" type="button"> |
| 50 | + {label}: 0 |
| 51 | + </button> |
| 52 | + ) as HTMLButtonElement |
| 53 | + let count = 0 |
| 54 | + |
| 55 | + el.onclick = () => { |
| 56 | + count += 1 |
| 57 | + el.textContent = `${label}: ${count}` |
| 58 | + el.classList.toggle('is-even', count % 2 === 0) |
| 59 | + } |
| 60 | + |
| 61 | + return el |
| 62 | +} |
| 63 | +``` |
| 64 | + |
25 | 65 | ## What The App Gives You |
26 | 66 |
|
27 | | -- Dynamic tabbed editing (add, rename, remove, and protect required entry tabs) |
28 | | -- Render mode switch: DOM or React |
29 | | -- Style mode switch: CSS, CSS Modules, Less, Sass |
30 | | -- Live preview with iframe-isolated style encapsulation |
31 | | -- In-browser lint and type diagnostics with jump-to-source navigation |
32 | | -- GitHub-connected workflows for Open PR and Push Commit |
33 | | -- AI chat with tab-aware edit proposals and explicit apply/undo controls |
| 67 | +- **Multiple Workspaces:** Create and switch between isolated projects without losing your current files. |
| 68 | +- **Dynamic Tabbed Editing:** Add, rename, remove, and protect required entry tabs within any workspace. |
| 69 | +- **Instant Share URLs:** Encode the current workspace state into a URL you can share or bookmark. |
| 70 | +- **Direct GitHub Synchronization:** Open pull requests and push commits from the browser. |
| 71 | +- **Render Mode Switch:** Toggle instantly between DOM or React runtimes. |
| 72 | +- **Style Mode Switch:** Support for CSS, CSS Modules, Less, and Sass. |
| 73 | +- **Live Preview:** Real-time updates with iframe-isolated style encapsulation. |
| 74 | +- **In-Browser Diagnostics:** Full lint and type diagnostics with jump-to-source navigation. |
| 75 | +- **AI Integration:** Chat with tab-aware edit proposals and explicit apply/undo controls. |
34 | 76 |
|
35 | | -This is not only "can this compile?" It is about shipping the whole iteration |
36 | | -loop in one place: edit, validate, preview, sync, and refine. |
| 77 | +The goal is a complete iteration loop without switching tools: edit, check, preview, and sync. |
37 | 78 |
|
38 | 79 | ## Why `@knighted/jsx` + `@knighted/css` Matter Here |
39 | 80 |
|
40 | 81 | The app demonstrates both libraries in realistic authoring conditions: |
41 | 82 |
|
42 | | -- `@knighted/jsx` provides a direct path from JSX to rendered output, |
43 | | - including DOM-first workflows. |
44 | | -- `@knighted/css` handles modern browser-side style compilation, |
45 | | - including Modules/Less/Sass modes. |
| 83 | +- `@knighted/jsx` provides a direct path from JSX to rendered output, including DOM-first workflows. |
| 84 | +- `@knighted/css` handles modern browser-side style compilation, including Modules/Less/Sass modes. |
46 | 85 |
|
47 | | -Together they show how much of the authoring cycle modern browsers can run |
48 | | -directly. |
| 86 | +Together they show what a browser can handle natively when you stop routing everything through a local build tool. |
49 | 87 |
|
50 | 88 | ## "Compiler-as-a-Service" Without A Build Farm |
51 | 89 |
|
52 | 90 | In this project, Compiler-as-a-Service means: |
53 | 91 |
|
54 | 92 | - CDN delivers modules and WASM artifacts. |
55 | | -- The browser session performs compile, lint, typecheck, render, and editor |
56 | | - interactions locally. |
| 93 | +- The browser session performs compile, lint, typecheck, render, and editor interactions locally. |
57 | 94 |
|
58 | | -It is service-oriented distribution with local execution. |
59 | | - |
60 | | -Mode-aware loading keeps costs aligned to usage: if you do not use Sass, |
61 | | -Sass does not load. |
| 95 | +It is service-oriented distribution with local execution. Mode-aware loading means you only download what you use: skip Sass mode and the Sass bundle never loads. |
62 | 96 |
|
63 | 97 | ## Why This Matters |
64 | 98 |
|
65 | | -This does not replace production pipelines. |
66 | | - |
67 | | -It lowers the cost of exploration while preserving enough workflow surface to |
68 | | -be useful for real component work. |
| 99 | +This does not replace production pipelines — it removes the setup cost for exploratory work where a full project scaffold is overkill. |
69 | 100 |
|
70 | | -When setup friction drops, teams try more ideas. When feedback is immediate, |
71 | | -they converge faster. When browser-native workspaces can sync to GitHub and |
72 | | -carry chat-assisted edit proposals, collaboration is lighter too. |
| 101 | +The loop is complete enough for real component work: write, render, diagnose, push. If you can share a URL or open a PR from the same tab you are editing in, the feedback cycle gets shorter. |
73 | 102 |
|
74 | | -For prototyping and component development, that is a meaningful shift. |
| 103 | +For prototyping and focused component work, that is worth something. |
75 | 104 |
|
76 | 105 | ## Try It |
77 | 106 |
|
| 107 | +> **Note:** The app loads its compiler and runtime from CDN on first visit. If something fails to initialize, a hard reload (`Cmd/Ctrl + Shift + R`) is usually enough to recover. |
| 108 | +
|
78 | 109 | - Live workbench: https://knightedcodemonkey.github.io/develop/ |
79 | 110 | - Source: https://github.com/knightedcodemonkey/develop |
| 111 | +- Worker DOM snapshot (Share URL): [Open workspace example](https://knightedcodemonkey.github.io/develop/?sws=H4sIAAAAAAAAE4VWYW_bNhD9Kwd2m-1VkqXUdVM5SpumHVYsWYskxT7UxUJTJ5kJRQokbdc1_N8HklacpN1mwLZ4vHs8vnt39oYsURuuJMmziDDVtBpNWJP6G29JRJhGarE8sSTPXhw-H2ejLB2n6bOIGElbM1eW5BvCS5KTlfm7epaVmLGX8fj5GOMRKw_il-noMD4o8RDT6vBFOUYSEbNoURsssXzvAklEVkrfmpYyvGSqRZIToRgV9zf-wHVnzvMKqY1dvkqitHFZ1i9iJkaGRERjqwLmjBqH1FAuSUTmSN1ZLnL448hW_7loZqhJLhdCuPUVt8JB_KX0LWp4--Hcu50qafGrvbTUul0uKbN8if5wWaI-V6Wzl6ohEamUtKfGfNKC5GRubWvy4dAZTVIrVQukLTcJU82QGXPwqqINF-vivbSoc26piFRrvkWrem5fp1E2SpJnB1GWpknyMk0n2WPLL7v4CzVTVgWALvZeUOddctMKui7MirpiWzozJ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L8_2S0TCra7o7P39X8jHf5LS8Xh0cHh4-N9w238AZi93_38JAAA) |
80 | 112 |
|
81 | 113 | If you want a fast product tour, try this sequence: |
82 | 114 |
|
83 | | -1. Add a new tab, rename it, and make an edit. |
| 115 | +1. Spin up a new workspace or add a new file tab, rename it, and make an edit. |
84 | 116 | 2. Toggle DOM -> React render mode. |
85 | 117 | 3. Toggle CSS -> Modules -> Less -> Sass style mode. |
86 | 118 | 4. Open diagnostics and jump to a reported line. |
87 | | -5. Connect BYOT (Bring Your Own Token) by adding a GitHub personal access token, then run Open PR / Push Commit. |
88 | | -6. Ask chat for a targeted tab update, then apply it. |
| 119 | +5. Copy a Share URL to send your current workspace state to someone else. |
| 120 | +6. Connect your GitHub personal access token (BYOT) to run an Open PR or Push Commit. |
| 121 | +7. Ask chat for a targeted tab update, then apply it. |
89 | 122 |
|
90 | | -That flow tells the product story better than any architecture diagram. |
| 123 | +That covers most of what the app does. |
0 commit comments