Hacker News new | ask | show | jobs
by saidnooneever 84 days ago
every page includes inline css, js etc. so each load it will pull all of that in each time. so each page transfer.

you could put the css and js parts that are common between them into separate files so that the browser can cache them and your users and server save some bandwidth.

happy to see most of it looks kinda decent. Not sure why you promote the site as being built in Go because its html, css and javascript. The backend can be go, but since it is not visible and theres no link to that code its impossible to see if its good or bad. the fact it does xyz doesnt really say anything about code quality..it just confirms the happy path works which is what AI is pretty good at.

it might be interesting to open it up for scrutiny and get some contributions if its good or some tips for footguns or bugfixes if there are such things.

not trying to discourage ofcourse :D and it sounds like a fun and rewarding project and ultimately i can navigate the pages just fine and it works ok on my connection regarding the bandwidth remark. (thats long run savings i guess, or handier when u receive higher volume traffic perhaps?)

1 comments

Fair comment. In my production code I always separate out the css and embed it in the go binary as files that can be cached. Having it in embedded into the page was really useful to iterate behind cloudflare and not worry about css caching but is a terrible practice.
Counterpoint, inlining CSS / JS used to be an optimization in early website optimizers, because fetching multiple files incurred more HTTP overhead, and (...I think) compression was more efficient working on a single file vs three.

I don't think these arguments hold up anymore with http 2/3, but still, it used to be an optimization.