handmade.network » Forums » Handmade JS
c-jm
Colin J. Mills
4 posts

Web developer by day. C programmer by night. Sorta like batman but with more segfaults.

#21154 Handmade JS
1 week ago Edited by Colin J. Mills on June 12, 2019, 2:09 a.m. Reason: Initial post

Does anyone have any experience with "Handmade JS" as in the simplest way of getting into web dev without alot of different frameworks? I find that I am always grasping at straws in terms of building "simple" web sites they always rely on React or Vue etc. I find that React is a good framework for a multitude of different reasons. I was wondering what everyone's experience is in trying to make the web a bit simpler.

Thanks

void* life;
AsafG
Asaf Gartner
36 posts

Handmade Network Staff

#21156 Handmade JS
1 week ago

You can make webapps without using libraries, and you'll probably end up with a much smaller JS package and better performance. Personally I don't like any of today's JS frameworks. I find that they only get in the way and I can do a much better job without them.
If you want to work without libraries, you'll need to have good familiarity with the browser's APIs. MDN has pretty good documentation and they link to the relevant parts of the spec at the bottom of each page.

Unfortunately, I don't know of any good guides for working without frameworks, but if you have more specific questions I can try to answer them.
mmozeiko
Mārtiņš Možeiko
1934 posts / 1 project
#21158 Handmade JS
1 week ago

That is pretty much only way how I do webpages. Just plain JS, CSS and HTML. Same way I did it 15 or so years ago.
c-jm
Colin J. Mills
4 posts

Web developer by day. C programmer by night. Sorta like batman but with more segfaults.

#21162 Handmade JS
6 days, 18 hours ago

Yeah I understand that this probably makes the most sense.

I find the DOM API to be a bit clunky that is the only complaint with Vanilla JS.

But simple is always better!

void* life;
OliverMarsh
Oliver
127 posts / 2 projects

A budding game developer and programmer

#21168 Handmade JS
6 days, 2 hours ago

I've tried doing a bit of the handmade style js. I've found you've got to 'play by the rules' a bit more than if you're writing a c style program. For example I tried adding an animation system using the 'setInterval' callback, and control the animations directly manipulating the DOM , but was not very performant. Whereas if i used the css animation keyword (a lot less work), the browser expected this, so was more performant. So reading up on conventional ways of doing things, would probably save time.
Delix
Ryan Fleury
160 posts / 1 project

Handmade Network lead and developer of The Melodist

#21173 Handmade JS
4 days, 14 hours ago

This is to some degree off-topic as it doesn't necessarily pertain to JavaScript (other than getting rid of it in some cases), but it does pertain to the more general concept of "handmade thinking" when it comes to web development.

I have been dabbling in the web recently out of necessity. A good approach for my case (my personal website) was custom static site generation. This was done with just a simple C program that parses my own text format that tries to be as close to a natural description of the static content as possible.

This approach has two notable benefits (among others):

  • I actually have the ability to separate the content from the web entirely, and can export directly to different formats, like BBCode or Markdown (any other format would just a different backend for the content transpiler).

  • I now have the ability to perform work at 'generation time' (much like Jai provides compile-time capabilities). One of the things that I can do at generation time is, for example, generating a list of all of the blog posts I've written, sorted by date. This helps move work that is often done at runtime with JavaScript to generation time, which happens offline. This is better for the end-user, as their browser doesn't need to do work that could've been done offline.


  • I was also surprised to hear from Ben Visness and Asaf Gartner that there is quite a bit of interesting server-side work that can be done in a handmade fashion. Some of the options that I heard about were CGI programs, where a webserver is configured to run an arbitrary command when it receives a particular HTTP request, then the command is expected to produce HTTP output in stdout (this command could be, for example, your own C program), and additionally the concept of a custom reverse-proxy HTTP server (which only communicates with the main outward-facing web server locally server-side, so there isn't the concern of security), which seems like it could be up and running in a relatively short amount of time.

    Handmade Network lead and developer of The Melodist