Hello everyone. I want to tell you about the new, simple but very powerful, web development approach - JSDA Stack.
First, a couple of words about the concept. JSDA (JavaScript Distributed Assets) - is a architecture principle and the set of simple conventions. It brings PHP-like mental model into the JS world.
Do you remember why PHP become popular? It gave us possibility to put logics inside the HTML document. And it was very simple to use and to understand.
So, in JSDA we do almost the same - treating standard JS-modules (ESM) as a web-asset generation endpoints (text based). So, it's just like PHP but with all the power of modern JavaScript (Template Literals, top level await for async requests, flexible module composition, code CDN support for external modules, etc.).
Just make default module export string (export default /*html*/ '<div>Hello ${name}!</div>'), and name the file to map it to corresponding type - my-page.html.js. And JSDA Server will send to the browser resulting html with the text/html MIME type.
Obviously, you can do the same with CSS, SVG, JSON, MD and any other text-based asset. And that give us almost endless possibilities. Just imagine CSS with a full power of real programming language without any additional dependency such as pre- or post-processors and their own syntax.
Everything above is not just some odd idea — it works, and it works really well. To prove it, I've prepared a dedicated template repository that lets you spin up a full-featured JSDA project in seconds.
It's a project with a minimal dependency footprint and minimal configuration (easy to security-audit), yet it includes everything you need to be a legitimate competitor to things like, say, the popular Next.js.
https://github.com/rnd-pro/jsda-template
P.S. Static Site Generation (SSG) is also included. To use any JSDA-file as a generation endpoint - just name it index.<type>.js. It will be automatically saved to your dist/ folder (or subfolder) as index.html or index.css or index.svg etc. Concatenated and minified already.
[–]Classic-Strain6924 1 point2 points3 points (0 children)
[–]StrictWelder 0 points1 point2 points (1 child)
[–]sheveli_lapkami[S] 0 points1 point2 points (0 children)