danprince / sietch Goto Github PK
View Code? Open in Web Editor NEW๐๏ธ Markdown static site generator that can render and bundle interactive TypeScript components at build time
Home Page: https://sietch.netlify.app
๐๏ธ Markdown static site generator that can render and bundle interactive TypeScript components at build time
Home Page: https://sietch.netlify.app
Still on the fence about supporting React. The good arguments for using it are mostly to do with the ecosystem, and that's potentially something that could be patched over with an esbuild plugin that aliases preact/compat
.
It works out of the box in a verbose way, inside vanilla components.
/** @jsxImportSource react */
import { useState } from "react";
import { hydrate as _hydrate } from "react-dom/client";
// https://github.com/anonyco/FastestSmallestTextEncoderDecoder/issues/18
import "fastestsmallesttextencoderdecoder/EncoderDecoderTogether.min";
import { renderToString } from "react-dom/server.browser";
let Counter = ({ count: init = 0 }) => {
let [count, setCount] = useState(init);
return <button onClick={() => setCount(count + 1)}>{count}</button>;
}
export function render(props) {
return renderToString(<Counter {...props} />);
}
export function hydrate(props, element) {
hydrate(<Counter {...props} />, element);
}
And a lot of the mess here could be cleaned up with a framework definition, like there is for Preact.
/** @jsxImportSource react */
import { useState } from "react";
export default ({ count: init = 0 }) => {
let [count, setCount] = useState(init);
return <button onClick={() => setCount(count + 1)}>{count}</button>;
}
I'm just not sure whether the complexity of apps where React becomes a better option than Preact is something to encourage in a SSG that's designed for tiny interactive blocks.
Part of the initial draw for Go with Sietch was the appeal of the standard library, using esbuild natively, faster compiled output, and cross platform binaries without headaches.
In practice, a number of those either haven't worked out, or other factors have diluted the benefits that Go ends up having over Node.
So, unfortunately, I'm considering rewriting Sietch in Node (although still open to Deno/Bun depending on ecosystem compatibility). Here's the rough estimation on what I expect to change throughout this process.
As of evanw/esbuild@4bd03f3 esbuild gives me a much nicer way to stitch together JS/CSS files that belong together. Should be able to clean up some of the brittle code that relies on bundles having names based on ids.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.