Live data from Hacker News

How to build a website without frameworks and tons of libraries

kodingkitty.com

71–80 of 270 posts

Re: How to build a website without frameworks and tons of libraries

#71
post #20

Using tailwind and jinja...

Reminds me a bit about the minimalism trend where people boasted about getting rid of all their belongings, only to mention at the end that they borrow everything they need from their parents or roommates.

Re: How to build a website without frameworks and tons of libraries

#72

Earlier quoted context omitted.

> First, your dark mode is implemented wrong in the lazy corner-cutting way of doing JS post-load ... I agree with your whole comment, but the media query approach is also tricky. You typically still want to offer a toggle while respecting prefers-color-scheme, and you may want to give priority to whatever choice the user has made with that toggle if they've used it on your site before. This still requires JS and loc…

Doesn't that make the page completely unreadable for those few who have Javascript disabled though?

You add a simple tag to the top of the body that does the right thing for them

Re: How to build a website without frameworks and tons of libraries

#73
post #10

This seems to fall into the 'simplistic, not simple' school of thought. You can have a relatively simple website if it doesn't do anything and if it cuts corners. Take your dark mode, which is just about the only nontrivial feature I see on this page. (One could also criticize the low contrast of the appearance and other problems, but that's less relevant to the simplicity thesis you're claiming.) First, your dark mo…

> First, your dark mode is implemented wrong in the lazy corner-cutting way of doing JS post-load ... I agree with your whole comment, but the media query approach is also tricky. You typically still want to offer a toggle while respecting prefers-color-scheme, and you may want to give priority to whatever choice the user has made with that toggle if they've used it on your site before. This still requires JS and loc…

You can also swap out the CSS file for one that explicitly sets/unsets light/dark mode. This allows for a website that works in any browser even if your Javascript breaks or doesn't load.

Or you could use cookies. No need to mess with localStorage. Just set a cookie "prefersDarkMode" to true or false and have the backend send the right file. No need for an interactive backend, nginx can handle serving files based on cookie contents. No need for cookie popups/walls either.

Re: How to build a website without frameworks and tons of libraries

#74
post #21

Slightly off-topic: His single "index.php" with jQuery is helping him to earn thousands per month. https://twitter.com/levelsio/status/1675829733668319233/phot...

Just because you can doesn't mean you should. Just because it's one file doesn't mean it's better. It'll be shit to maintain, it'll make working with multiple developers a pain (merge conflicts much) and having one file means having minimal structure at best. There's a reason why we split things up into multiple files.

I could also write his cool startup in just one line if I just remove all newlines. Does that make it even better than 14.000 lines? Obviously not.

Re: How to build a website without frameworks and tons of libraries

#75
Did anyone else notice the fact that on the home page, for any window width >= 1280px, the text "Your design. Our HTML and CSS" (in the body) overlaps the text in the footer (and is strangely hard to select for copying to the clipboard). In fact the footer tends to overlap the body at various window sizes. Can't help but think that you'd wanna at least get a simple thing like that right on such a page...

Edit: I noticed it's using "rem" for specifying the font size, and I've actually seen quite a few sites where the font sizes look wrong using that unit, I'm wondering if it's something specific to my system (but happens both with Chrome and Edge).

Re: How to build a website without frameworks and tons of libraries

#76
tldr; the author is using jinja templates + tailwind + a python script

It all feels a bit moot because most frameworks exist to create website that tend to be web apps If you just want static website well it's pretty easy to use any kind of simple templating system that will give you some html + css + optionnally js.

Hell you don't even have to generate the file, you can use CGI to generate your page on the fly with CGI (I like haserl)

If you like or are competent in dealing with quirks, you can do it all by hand instead.

I just got into webdev and I really like Svelte and SvelteKit so far.

Svelte works well if all you want is to colocate a bit of html, css and js. You can really start simple and iterate when you have bigger needs. Now, if I want to make a webapp I'll use SvelteKit even if only for the baked in client side routing based of the structure of the project.

Re: How to build a website without frameworks and tons of libraries

#77

Earlier quoted context omitted.

> First, your dark mode is implemented wrong in the lazy corner-cutting way of doing JS post-load ... I agree with your whole comment, but the media query approach is also tricky. You typically still want to offer a toggle while respecting prefers-color-scheme, and you may want to give priority to whatever choice the user has made with that toggle if they've used it on your site before. This still requires JS and loc…

You can also swap out the CSS file for one that explicitly sets/unsets light/dark mode. This allows for a website that works in any browser even if your Javascript breaks or doesn't load. Or you could use cookies. No need to mess with localStorage. Just set a cookie "prefersDarkMode" to true or false and have the backend send the right file. No need for an interactive backend, nginx can handle serving files based on…

> This allows for a website that works in any browser even if your Javascript breaks or doesn't load.

I just use for this. If you don't have Javascript you're just going to get whatever your prefers-color-scheme is set to. Users without JS don't expect things like a dark-mode toggle to work anyway.

Re: How to build a website without frameworks and tons of libraries

#78
post #33
post #21

Slightly off-topic: His single "index.php" with jQuery is helping him to earn thousands per month. https://twitter.com/levelsio/status/1675829733668319233/phot...

Are there ways to view tweets without an account? Kind of like archive.is? For now, I could enter it in Google and view cache, but I assume that will go away soon. And if I understand correctly, it's not the index.php, but the actual service behind it, that earns thousands per month. Looks nice :)

There used to be, but Elon nuked it. I think, as commenters, we should start embedding the content of a tweet right after we link to it.

Re: How to build a website without frameworks and tons of libraries

#80

A tiny mostly static website written by one person certainly doesn’t need anything special. A website/webapp with millions of visits per day and a ton of stakeholders requesting features every week, on the other hand... It all depends on the use case, like most stuff.

Agreed. I wonder what the ratio is between the former and the latter...
Post reply on HN