Live data from Hacker News

How to build a website without frameworks and tons of libraries

kodingkitty.com

231–240 of 270 posts

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

#231
post #211

Earlier quoted context omitted.

> block the entire page, really? talk about burning down the village to save it I'm curious for what the other approach is. Users find it annoying to refresh the page and have their dark-mode setting change, or have their dark-mode setting change while navigating the site. So I have to block paint until I can query local storage in order to avoid flashing, what's the alternative? Below someone suggested using cookies…

You don't need to hide the entire page until fully rendered. You inline in the head just the bits of CSS/JS you need and set styles from there, so if you are in dark mode, it's set to dark before anything has rendered, without needing to block a huge amount of time. You can see how it works on my site https://gwern.net/ - set dark mode in the toggle (assuming it is not your system setting already), and refresh or for…

On mobile safari the little Control Strip at the bottom doesn’t appear after the first couple of refreshes. I can see it try to slide up then it dies.

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

#232

Earlier quoted context omitted.

I see your point. My recommendation if you wish to improve your designs is to do them outside of CSS if you don't already. With something like figma or Penpot you will have your fonts, palette, spacing and layout all predefined. Then once all your views are created using these common elements, you only need to transcribe them as classes in your CSS and use those few classes where needed in your HTML. I'm not a design…

See, my problem is that I don't want to get good. I just want to ship.

Yeah we all have that problem but the design factors in the customers' decision to buy and designers cost an insane amount so what can you do.

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

#233

I believe the most minimalistic and productive way is to just use php. The language was specifically just created for that. If it's a simple site then you don't need composer you don't need router logic. just create separate files for header footer navigation and include them on each page.

Agreed, with the caveat that it's only so easy if a server is already set up for it. Otherwise it loses a bit of it's edge, but not by much.

We are being simple, and I consider a simple PHP site about one step above HTML and CSS in required complexity, and about 5 steps below anything else in regards to tooling/setup/execution.

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

#234
post #180

Earlier quoted context omitted.

try the tutorial? https://learn.svelte.dev/tutorial/introducing-sveltekit

There's a fairly high barrier for people to commit to installing a tool and building with it, especially if you haven't shown them what they'll get out. Docs look good otherwise.

That tutorial has an embedded dev server running on (I think) StackBlitz, so the barrier to taking a look is actually pretty low.

(Of course it doesn't work for me with my normal firefox security settings, but running it in Chrome/Chromium is easy enough.)

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

#235

I’m just really tired of this debate about “frameworks” and “complexity”. If your client asks you for a custom CMS with a multi-stage publishing workflow with i18n and regulation-compliant a11y, you’ll need high-powered tools to build it in the time clients expect. Lots of clients in enterprise are like this, which is why the demand for this stuff is so high. If you’re working in B2C this may be surprising, but this…

I agree. Furthermore if you're trying to do anything complex and you don't use a framework, you just end up creating another framework. But this time there are no updates or help on Stack overflow for the person who inherits the code.

Eh, I read this a lot. An app architecture is not a framework, frameworks get complicated because they have to be generalised enough to serve multiple projects with different requirements which leads to a ton of abstraction. Then because they're complicated they're difficult to learn.

An architecture concept just needs a page or two of docs and diagrams to understand, and the code is right there in the app. You don't need a framework to implement relevant design patterns.

Those apps can also last longer, because there's less pressure to rewrite in React/Svelte/Solid/etc when the existing code isn't dependent on some obsolete framework - Ember/Angular 1/etc.

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

#236

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.

Totally agree. I think where complexity really creeps in is as you add multiple new content editors with varying skill sets.

If you want a team of people that don't know HTML or rest of the stack to edit, manage and deploy it then you're going to need a more complex abstraction.

The alternative might be a training programme for new staff in HTML, CSS, git and rsync.

You're trading one type of complexity for another. As you say, it all comes down to use cases.

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

#237

As someone who was around when people still wrote apps in plain HTML and .js files without a build step, I'm surprised to read stuff like 'the simple toolchain for building our web: Watchdog.py detects the file change and ... renders Jinja template into index.html and ... calls Tailwind CSS CLI to generate styles.min.css...' You don't need any of those tools. You can build a fast website and even a complex reactive w…

Do you ned a lot of experience to know how to start browser-native tools? I wouldn't have a clue how to start with Web Components and all the other things, to build a I don't think I have the energy to move off from Sveltekit to a new thing, without having to re-learn everything and make a ton of mistakes

It's been a while since I dipped into it, but Web Components use this thing called Shadow DOM to encapsulate the CSS inside from being affected by the stuff outside. Great for compartmentalization, but unnecessary for my personal needs.

So if you're curious about the concept, check out Custom Elements. Same thing, but no Shadow DOM. I found them to work quite well for a toy project I made a couple years ago.

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

#238

Earlier quoted context omitted.

I agree. Furthermore if you're trying to do anything complex and you don't use a framework, you just end up creating another framework. But this time there are no updates or help on Stack overflow for the person who inherits the code.

Eh, I read this a lot. An app architecture is not a framework, frameworks get complicated because they have to be generalised enough to serve multiple projects with different requirements which leads to a ton of abstraction. Then because they're complicated they're difficult to learn. An architecture concept just needs a page or two of docs and diagrams to understand, and the code is right there in the app. You don't…

> An app architecture

i.e. a framework.

> Then because they're complicated they're difficult to learn.

It's easier to learn a publicly available framework, as there is lots of help on Stackoverflow, and usually the popular frameworks have good, or just existing, documentation.

> existing code isn't dependent on some obsolete framework - Ember/Angular 1/etc.

The "app architecture" can also become obsolete. But now instead of a migration path, you're stuck with the person who made the "app architecture" most likely having left the company.

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

#239
I build my sites the static way too these days. The best part is that I can host my sites on Cloudflare Pages, which is completely free and can easily handle a traffic spike. Plus, it has a built-in CDN, so it's super quick.

I use Astro for my websites, because I'm familiar with the framework and have used it for many of my clients. Even though Astro is a framework, it doesn't feel like one when creating content inside it.

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

#240
The first hurdle in trying to make simple multipage apps with handwritten HTML/CSS is, as the author mentioned, getting to the step where you have reused components across pages and have to jump into a server-side templating setup like PHP, or use something that introduces a build step if you want to stay static. I don't know why there isn't a simple method for including HTML partials incrementally in handwritten sites without doing either of these. WebComponents and slots seemed perfect for this but they force you to define them with JS.
Post reply on HN