Hacker News new | ask | show | jobs
by sarchertech 3 days ago
I’m not going define away blocks of HTML inside of php scripts as not writing HTML by hand, but if you want to do that then sure most people were never writing HTML and CSS by hand.
1 comments

I agree, I wouldn't classify PHP as "not writing HTML by hand". But that's not what I'm talking about. Most websites in the last 20 years have heavily leaned into client-side rendering, picking up with jQuery circa 2006. It's only recently with htmx that the pendulum has started swinging back toward server-side rendering.
I was around for all of this. Websites using jQuery were almost all using hand written HTML or HTML generated by something like rails web templates or PHP.

SPAs didn’t go mainstream until almost 10 years after 2006. And even at their height they never represented the majority of all websites.

But also most SPAs aren’t any less HTML by hand than using PHP templates are.

Are you sure about that? Most of the mid-2000's jQuery components bundled their HTML and CSS in bespoke template strings within JS. If you remember, jQuery's `.css()` method accepted JSON to set CSS properties, and `.html()` accepted a string to set the inner-HTML.

And if you needed to manipulate strings to generate HTML, you'd be doing so with some kind of template mechanism, like string concatenation or substring substitutions. John Resig, author of jQuery, wrote Secrets of the JavaScript Ninja in 2008 [1], offering a small templating engine that does exactly that. The first commit in the Underscore library credits this book for their `template` method [2].

I think your chronology is skewed or confused. "SPAs" have been brewing in some form since the mid-2000's, when people stopped writing plain old HTML and CSS. Everything was jQuery UI widgets and AJAX, Prototype and Underscore templates. HTML died a very long time ago.

[1]: https://blog.codinghorror.com/secrets-of-the-javascript-ninj...

[2]: https://github.com/jashkenas/underscore/commit/02ede85b539a8...

I’m 100% positive. I was very involved in the CSS community back then.

The ability to do SPAs existed, but the vast majority of people weren’t building them. The time period you’re talking about was peak rails erb templates. Which is definitely “writing html by hand”.

I knew plenty of people who were getting paid to convert psd mockups into HTML/CSS around that time. There was a whole industry around hand written psd to HTML, which was eventually mostly outsourced to India.

In 2008 I made most of my money making static brochure sites for small/mid-sized businesses. Most small businesses around that time had something similar. It was very easy back then to browse most of the web with JavaScript disabled.

Chalk it up to different perspectives.

I - being old as dirt - was also around for it. Circa 2002 or 2003, we were writing CMSs in PHP which were already well beyond the simplistic concept of rendering HTML tables from database columns. Smarty templates were pretty common back then. It's hard to treat these templates as "writing HTML by hand" because the templates are a higher level of abstraction.

Rails was quite popular, but I never got into it. I went from PHP to Python (avoiding Django) and then to nodeJS. At the time, the MVC architecture was making a comeback, but the mapping of HTML/CSS/JS was never 1:1 with it. Small fragments of HTML and CSS where always littering the JS or PHP/Python. The clean separation was never fully realized. For this reason, JSX was seen as a real win.

The reason I chose to focus specifically on "templates and DSLs" in my original comment is because once the level of abstraction is raised to the point where HTML becomes a compilation target, it is no longer HTML by definition. The browser cannot render the template or DSL without the preprocessor (XSLT is about as close as that ever got). This is especially true with client-side templates. For example, using pre-made widgets like jQuery date pickers is so far removed from writing HTML that a reasonable conclusion is that jQuery developers do not know HTML or JavaScript as a matter of course [1]. But yeah, this was all burgeoning in the early/mid 2000's, and really kicked into full throttle with jQuery.

> It was very easy back then to browse most of the web with JavaScript disabled.

It was easier, but not fool-proof. Client-side rendering wasn't in full swing, but Java Applets, Shockwave, and Flash certainly were in the years leading up to it.

[1]: https://www.quora.com/Why-are-there-people-who-know-jQuery-b...