On Fri, May 18, 2018 at 07:32:49PM +0100, Martin Tournoij wrote:
> On Fri, May 18, 2018, at 18:38, Hiltjo Posthuma wrote:
> > > As for my general thoughts on minification: use common sense. If you're
> > > creating one of those pages with 3M of JavaScript then it probably makes
> > > sense. If you're creating something more sane then it's probably just
> > > wasted effort at best.
> > >
> > Don't create pages with 3MB of Javascript, that's insane.
>
> I agree. My boss, our web designers, and many other people don't, so
> unfortunately I do have to deal with it.
>
> > I think concatenation/bundling in one file is fine, but not
> > minification, because it makes the source unreadable.
>
> I'm not really sure if I understand what the harm in that is as such? I
> personally find it useful to have the full source for debugging my
> *own* websites, but I couldn't care less what someone else does with
> their website. Do you ever read the source of random websites?
>
I do. For example it can be useful to overwrite insane layout things or
write a non-javascript program to use the site "API".
Make sure to write little code, then no minification is needed. Just use
a little Javascript to make the site nicer to use, for example for form
highlighting in "validation" (not real validation of course, this has to
be done server-side always). Make sure using Javascript is not mandatory.
> > Carefully evaluate what you actually use in the site. Don't use
> > bloated Javascript (such as jQuery) and CSS frameworks (such as
> > Bootstrap).
>
> Sometimes using jQuery or Bootstrap makes sense. It really depends on
> what you're building. If you're building a more complex website then
> using jQuery can be perfectly reasonable. For a simpler website with
> little JS? Probably not.
>
You never need jQuery for this: for querying the DOM using querySelector or
querySelectorAll or something. The days IE6 compatibility was required
are long gone too.
Here are a list of scripts without jQuery with (optional) reusable components
for a website:
https://git.codemadness.org/jscancer/files.html
When W3C/WhatWG finally writes a clear decent standard and it is implemented
consistently I'll use it. Unfortunately they are a bunch of wankers in a dark
room with no real-world experience. They are only interested in adding DRM to
the web.
Bootstrap adds atleast 100KB+ of CSS as a base "template". This is a
waste of resources (CPU, bandwidth, etc).
Don't spread bad web ideas to suckless.
--
Kind regards,
Hiltjo
Received on Sat May 19 2018 - 11:16:17 CEST