|
1 | | -# Forget The Build Step: Building A Compiler-as-a-Service Playground |
| 1 | +# Forget The Build Step: A Browser-Native IDE For JSX + CSS |
2 | 2 |
|
3 | | -In modern frontend development, we have normalized a heavy local setup cost. Want JSX and modern CSS dialects? Install a large dependency graph, start a dev server, and wait for transpilation loops before you can really iterate. |
| 3 | +Frontend tooling has become incredibly capable. |
4 | 4 |
|
5 | | -I wanted to test a different path: what if we removed the terminal from the inner loop? |
| 5 | +It has also become very heavy. |
6 | 6 |
|
7 | | -That experiment became @knighted/develop, a browser-native playground that treats your tab as a real-time compiler host. |
| 7 | +For many UI experiments, the first thing you do is not write code. You install dependencies, run a dev server, wait for transforms, and only then start iterating. |
8 | 8 |
|
9 | | -## The Core Idea |
| 9 | +I wanted to try a different baseline: |
10 | 10 |
|
11 | | -Most playgrounds rely on a backend build service. @knighted/develop flips that model: |
| 11 | +What if the browser is the dev environment? |
12 | 12 |
|
13 | | -- JSX compilation and execution happen in the browser. |
14 | | -- CSS transforms (including CSS Modules, Less, and Sass) run in the browser. |
15 | | -- Compilers are loaded on demand from CDN sources. |
| 13 | +That idea became [@knighted/develop](https://github.com/knightedcodemonkey/develop). |
16 | 14 |
|
17 | | -The result is a development loop that feels direct: type, compile, render, repeat. |
| 15 | +It is a lightweight in-browser IDE built to showcase [@knighted/jsx](https://github.com/knightedcodemonkey/jsx) and [@knighted/css](https://github.com/knightedcodemonkey/css), with dependencies delivered over CDN ESM instead of requiring a local build step in the inner loop. |
18 | 16 |
|
19 | | -## The Stack Behind It |
| 17 | +## The Loop, In Practice |
20 | 18 |
|
21 | | -Two libraries power the runtime: |
| 19 | +Open a page, write JSX and styles, switch rendering/style modes, run lint/typecheck, and see results immediately. |
22 | 20 |
|
23 | | -- @knighted/jsx: JSX that resolves to real DOM nodes. |
24 | | - - No virtual DOM requirement. |
25 | | - - You can use declarative JSX and imperative DOM APIs in the same flow. |
26 | | -- @knighted/css: A browser-capable CSS compiler pipeline. |
27 | | - - Supports native CSS, CSS Modules, Less, and Sass. |
28 | | - - Uses WASM-backed tooling for modern transforms. |
| 21 | +No local bundler needed for that loop. |
29 | 22 |
|
30 | | -Under the hood, the app leans on CDN resolution and lazy loading, so it fetches compiler/runtime pieces only when a mode needs them. |
| 23 | +## What Makes It Fun To Use |
31 | 24 |
|
32 | | -## Why "Compiler-as-a-Service"? |
| 25 | +The app is intentionally practical, not just a demo shell: |
33 | 26 |
|
34 | | -Compiler-as-a-Service here does not mean a remote build cluster. |
| 27 | +- Render mode switch: DOM or React |
| 28 | +- Style mode switch: CSS, CSS Modules, Less, Sass |
| 29 | +- Live preview with ShadowRoot toggle |
| 30 | +- In-browser lint and type diagnostics |
| 31 | +- Diagnostics drawer with jump-to-line navigation (mouse or keyboard) |
35 | 32 |
|
36 | | -It means the service boundary is split between: |
| 33 | +So it is not only "can this compile?" It is closer to "can I actually iterate on a component quickly?" |
37 | 34 |
|
38 | | -- global CDN infrastructure (module and WASM delivery), and |
39 | | -- the user device (actual compilation and execution). |
| 35 | +## Why `@knighted/jsx` + `@knighted/css` Matter Here |
40 | 36 |
|
41 | | -If you switch into Sass mode, the browser loads Sass support. If you stay in native CSS mode, it does not pay that cost. The compiler behaves like an on-demand service, but the work stays local to the tab. |
| 37 | +`@knighted/develop` is primarily a showcase app. |
42 | 38 |
|
43 | | -## What This Enables |
| 39 | +It demonstrates how these libraries behave in a real authoring environment: |
44 | 40 |
|
45 | | -- Fast feedback loops |
46 | | - - Rendering updates track edits with minimal overhead. |
47 | | -- Mixed declarative and imperative workflows |
48 | | - - Useful for low-level UI experiments and DOM-heavy component prototypes. |
49 | | -- Isolation testing with ShadowRoot |
50 | | - - Toggle encapsulation to verify style boundary behavior. |
51 | | -- Zero install inner loop |
52 | | - - Open a page and start building. |
| 41 | +- `@knighted/jsx` gives you a direct path from JSX to rendered output, including DOM-first workflows. |
| 42 | +- `@knighted/css` handles modern style pipelines in-browser, including Modules/Less/Sass. |
| 43 | + |
| 44 | +Using both together in one interface makes the bigger point obvious: modern browsers can do much more of the compile/authoring cycle than we usually ask them to. |
| 45 | + |
| 46 | +## "Compiler-as-a-Service" Without A Backend Build Farm |
| 47 | + |
| 48 | +In this project, Compiler-as-a-Service means: |
| 49 | + |
| 50 | +- CDN handles module and WASM delivery. |
| 51 | +- The browser tab does the actual compile, lint, typecheck, and render work. |
| 52 | + |
| 53 | +It is service-oriented distribution, local execution. |
| 54 | + |
| 55 | +And because loading is mode-aware, you only pay for what you use. If you never touch Sass, you never load Sass. |
53 | 56 |
|
54 | 57 | ## Why This Matters |
55 | 58 |
|
56 | | -The point is not to replace every production build pipeline. |
| 59 | +This is not trying to replace production pipelines. |
57 | 60 |
|
58 | | -The point is to prove a stronger baseline: modern browsers are now capable enough to host substantial parts of the authoring and compile cycle directly, without defaulting to local toolchain setup for every experiment. |
| 61 | +It is about lowering the cost of exploration. |
59 | 62 |
|
60 | | -For prototyping and component iteration, that changes the cost model dramatically. |
| 63 | +When the setup tax drops, you try more ideas. When feedback is instant, you discover faster. And when the browser is the platform, sharing a repro can be as easy as sharing a URL. |
61 | 64 |
|
62 | | -## Try It |
| 65 | +For prototyping and component iteration, that is a meaningful shift. |
63 | 66 |
|
64 | | -- Live playground: https://knightedcodemonkey.github.io/develop/ |
65 | | -- Source repository: https://github.com/knightedcodemonkey/develop |
| 67 | +## Try It |
66 | 68 |
|
67 | | -## Notes For Publishing |
| 69 | +- Live IDE: https://knightedcodemonkey.github.io/develop/ |
| 70 | +- Source: https://github.com/knightedcodemonkey/develop |
68 | 71 |
|
69 | | -If you post this on Medium (or similar), include a short screen recording that shows: |
| 72 | +If you are curious, start by toggling: |
70 | 73 |
|
71 | | -- switching style modes (CSS -> Modules -> Less -> Sass), |
72 | | -- toggling ShadowRoot on and off, and |
73 | | -- immediate preview updates while typing. |
| 74 | +1. DOM -> React render mode |
| 75 | +2. CSS -> Modules -> Less -> Sass style mode |
| 76 | +3. ShadowRoot on/off |
74 | 77 |
|
75 | | -That visual sequence communicates the Compiler-as-a-Service model faster than any architecture diagram. |
| 78 | +That sequence tells the story better than any architecture diagram. |
0 commit comments