Comment

Comment by Azrathud

I try to go minimal javascript. There are two main ways you can limit javascript: static site generation or a rendering via a backend language.

Solutions

Use a templating engine with a backend language. My goto is jinja. For example you create a nav template and then include that template in your larger templates. You can then render different templates depending on the given route or file.

Alternatively use a static site generator. I use pelican. The static files are generated upon deployment from markdown for content, scss for css, templates for html, etc. There are plugins for using minifiers.

For user specific data, You can give the user a randomly generated session id cookie generated via a backend language. The backend language generates further pages based on information retrieved from the session id cookie. The session id would correspond to state in some database. Async data loading cannot happen without client side javascript.

- Dev tools: Write tests. the backend language would have developer tools such as a debugger. Generally you can run a dev server which allows to to drop a breakpoint upon failure. (backend frameworks can support this) Alternatively, you can change the rendered HTML via a debug flag (for local testing).

For PHP, The HTTP server serves the rendered files from the backend language's application server / module therefore you normally wouldn't be able to directly edit the backend code via a web browser.

parent Azrathud 7 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton