3 ms·
Many frameworks do exactly that, including React and https://github.com/vanjs-org/van https://github.com/vanjs-org/van
by gdprrrr 3y ago
Many frameworks do exactly that, including React and https://github.com/vanjs-org/van https://github.com/vanjs-org/van
- naasking 3y agoI think Mithril was the first one to pioneer this.
- hparadiz 3y agoLol. I saw PHP libraries doing this 15 years ago. Literally cringing as I read the readme. We decided over a decade ago that writing HTML with code is rediculous but somehow it comes up again and again. A designer shouldn't need to code JavaScript to edit your design.
- naasking 3y agoPioneer this in the JS/client-side rendering world of course. Mithril is about 10 years old, so in the same ballpark. Web applications aren't just HTML though, that's why code might be a more appropriate format. You can argue that designers need better tools to edit structured markup in other formats, but that doesn't entail that HTML should be the default format. For instance, something like repl.it for mithril or similar that immediately renders the output so you can see the results would be useful.
- chrismorgan 3y agoNah, it’s waaaaay older than that. It’s been done from the beginning of machine-produced HTML. The probably slightly newer aspect is producing an intermediate representation that is then serialised to HTML, though I think that’s still going to be back in the ’90s. But the oldest examples I know of (while I was yet a small child) used functions and methods to produce serialised HTML strings directly, which was more efficient (at least in the languages in question) and also allowed you to mingle with string templating. Perl’s CGI.pm let this example be written no later than 1997 (no idea when it was actually written, can’t be bothered searching harder for older than CGI.pm 2.32): https://github.com/Perl/perl5/blob/54310121b442974721115f93666234a200f5c7e4/eg/cgi/nph-clock.cgi https://github.com/Perl/perl5/blob/54310121b442974721115f936... For stuff that worked on the frontend, it’s still way older, though it tended more to XML-based stuff like XSLT (… which still works in browsers now, e.g. https://chrismorgan.info/blog/tags/meta/feed.xml https://chrismorgan.info/blog/tags/meta/feed.xml is an Atom feed but the <?xml-stylesheet?> processing instruction is basically a pointer to the file for the browser to use to convert it to HTML which it then renders). But there were definitely things in this vein even on the frontend in active use more than five years before Mithril, though I can’t be specific as my memory is fuzzy as I wasn’t paying much attention to it all back then.