Discussion:
[dev] suckless too to minify CSS, JS and html
ilf
2018-05-18 16:02:18 UTC
Permalink
Use HTTP compression and keep your source readable.
Does anyone has advice for a suckless tool to minify JS, CSS and HTML
files? I use sed for now, but it might not be the best solution.
--
ilf

If you upload your address book to "the cloud", I don't want to be in it.
Joseph Graham
2018-05-18 18:28:27 UTC
Permalink
Hi,

I really don't approve of this. It's a waste of effort on your part,
and all it achieves is making the code hard to read.

Just slap some gzip on it and you're all good.

Best,
Joseph
Hello,
Does anyone has advice for a suckless tool to minify JS, CSS and HTML
files? I use sed for now, but it might not be the best solution.
Furthermore, I was wondering what is the opinion of the list about minifying CSS, JS
and html files?
- Do you minify on your websites ? Why ?
- What tool do you use to do so?
Regards.
--
thuban
--
Joseph Graham; a tech-rights advocate, an Englishman and a Catholic.

My PGP key: 0x8cd7227da467d3ed404f6eefdb590f739e5ac458

I have two blogs: www.naughtycomputer.uk and www.technologicallyadvancedhuman.uk
I write software: https://www.suckmore.uk
I run a web forum: https://www.freesoftwareuk.org.uk
I run a public Taskenizer installation: https://taskenizer.xylon.me.uk
And a platform for Free Software success stories: www.freedcomputer.net
Ivan Tham
2018-05-18 16:12:40 UTC
Permalink
Hello,
Does anyone has advice for a suckless tool to minify JS, CSS and HTML
files? I use sed for now, but it might not be the best solution.
Furthermore, I was wondering what is the opinion of the list about minifying CSS, JS
and html files?
- Do you minify on your websites ? Why ?
- What tool do you use to do so?
I did this for my website.

CSS was already partly written minimally and optimized with sed + tr.
HTML is also optimized with sed with optional tags manually removed.

source: https://git.pickfire.tk/www/
--
Do what you like, like what you do. -- Pickfire
Quentin Rameau
2018-05-18 19:47:00 UTC
Permalink
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.
You don't have to deal with it by just accepting it though.
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?
If you don't understand the concept of having the source code for the
tools you're using, then you don't understand OSS.
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.
Yes, maybe using jQuery for building crap makes sense.
I'm not sure why you would do such thing though.
Teodoro Santoni
2018-05-18 18:30:44 UTC
Permalink
compilers considered harmful because they make the source unreadable
Does anyone has advice for a suckless tool to minify JS, CSS and HTML
files? I use sed for now, but it might not be the best solution.
Furthermore, I was wondering what is the opinion of the list about
minifying CSS, JS
and html files?
- Do you minify on your websites ? Why ?
- What tool do you use to do so?
I wrote this a while ago: https://github.com/Carpetsmoker/singlepage
The main goal isn't really to "minify" files, as such – although it can
do that – but more to bundle them in a single page. This allows me to
use the same CSS for several HTML documents while still serving a single
HTML document without any external dependencies (a concept that I like).
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 think concatenation/bundling in one file is fine, but not minification,
because it makes the source unreadable. Carefully evaluate what you
actually
use in the site. Don't use bloated Javascript (such as jQuery) and CSS
frameworks
(such as Bootstrap).
Make sure to "gracefully fallback" so Javascript is not required.
One of the latest trends in Javascript bundle compilation. For example
have
a
look at the new Reddit layout. There all the CSS classnames are
randomized.
Stop this madness.
--
Kind regards,
Hiltjo
In the "semi-binary blobs which get rendered as cool documents"
market, DjVu, PDF, CBZ are superior to HTML
Quentin Rameau
2018-05-18 15:50:00 UTC
Permalink
Hello,
Hello,
Does anyone has advice for a suckless tool to minify JS, CSS and HTML
files? I use sed for now, but it might not be the best solution.
Don't do this.
Hiltjo Posthuma
2018-05-19 09:16:17 UTC
Permalink
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
harry666t
2018-05-22 10:17:20 UTC
Permalink
I wonder how many people here that advise against minification, keep
their compiled binaries "readable". Please start shipping your
makefiles with "-Og" instead of "-Os" then.
Post by Hiltjo Posthuma
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
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
Quentin Rameau
2018-05-22 12:21:41 UTC
Permalink
Post by harry666t
I wonder how many people here that advise against minification, keep
their compiled binaries "readable". Please start shipping your
makefiles with "-Og" instead of "-Os" then.
We don't ship binaries, only source code, and a way to build them.

Then how you compile your own binary is your choice, it's as easy as
supplying a compiler option in CFLAGS or LDFLAGS.
v4hn
2018-05-22 16:36:16 UTC
Permalink
Post by harry666t
I wonder how many people here that advise against minification, keep
their compiled binaries "readable".
I wonder how many people here looked at this thread and thought
"stop that nonsense and do something useful with your life".

*The* main advantage of any interpreted language is readability at runtime.
If you don't want that, you might as well build ActionScript3 bundles.

There are regular discussions on this platform that end with
"www sucks; everything's too complex".
Sure, go ahead and minify. Nobody will look at your sources
and that might make you sleep better.
It's not likely people will ever try to read your websites anyway...


v4hn
Guilherme Vieira
2018-05-22 18:30:58 UTC
Permalink
Post by harry666t
I wonder how many people here that advise against minification, keep
their compiled binaries "readable".
I wonder how many people who make that comparison realize it's a false
dichotomy.
Like v4hn alluded to, scripting languages have the distinct ability to
be executed easily and
directly from source. Doing the same with compiled programming
languages is possible, but
not simple or very practical. So it's no contradiction at all to run
compiled code while still
advocating against HTML/CSS/JS minification, in particular when you're
also a free software
advocate. For compiled languages, there are on-going efforts for
verifiable, reproducible builds.
HTML/CSS/JS minification goes in the precise opposite direction by
putting effort into turning
readable code into unreadable code for no good reason.

G.
Peter Nagy
2018-05-23 06:34:49 UTC
Permalink
The distinction isn't that clear though, e.g. many scripting languages can byte compile the sources. And the "no obvious reasons" is as usual speed, be it runtime or network. An OSS website can still publish the real, readable sources with steps how to use it, just like compiled languages do. I wouldn't be so quick with the categorization. Compiling is a type of preprocessing step and many other languages have other such steps.

I still loathe js though.
--
Peter Nagy

- To reach a goal one has to enjoy the journey
Post by Guilherme Vieira
Post by harry666t
I wonder how many people here that advise against minification, keep
their compiled binaries "readable".
I wonder how many people who make that comparison realize it's a false
dichotomy.
Like v4hn alluded to, scripting languages have the distinct ability to
be executed easily and
directly from source. Doing the same with compiled programming
languages is possible, but
not simple or very practical. So it's no contradiction at all to run
compiled code while still
advocating against HTML/CSS/JS minification, in particular when you're
also a free software
advocate. For compiled languages, there are on-going efforts for
verifiable, reproducible builds.
HTML/CSS/JS minification goes in the precise opposite direction by
putting effort into turning
readable code into unreadable code for no good reason.
G.
Guilherme Vieira
2018-05-23 06:51:06 UTC
Permalink
Post by Peter Nagy
The distinction isn't that clear though, e.g. many scripting languages can byte compile the sources. And the "no obvious reasons" is as usual speed, be it runtime or network. An OSS website can still publish the real, readable sources with steps how to use it, just like compiled languages do. I wouldn't be so quick with the categorization. Compiling is a type of preprocessing step and many other languages have other such steps.
True. Looks like I just countered a false dichotomy with another false
dichotomy (scripted => run directly from script / compiled => you
can't). Duh.
Ori Bernstein
2018-05-23 20:39:44 UTC
Permalink
On Tue, 22 May 2018 12:17:20 +0200
Post by harry666t
I wonder how many people here that advise against minification, keep
their compiled binaries "readable". Please start shipping your
makefiles with "-Og" instead of "-Os" then.
Yes, please. Keeping debug information is a useful default. For most
programs, the space of keeping the debug information around is well
worth the additional debuggability and clarity in bug reports.
--
Ori Bernstein <***@eigenstate.org>
Jules Merit
2018-05-18 21:04:52 UTC
Permalink
Plan9 Doom Port id faces of death #missioncomplete
Miles Kilo stoneman
sgi 0xbfc xxx turkey shoot
James Tomaschke CA B550 4567 my id
/ckeen

On Fri, May 18, 2018 at 1:54 PM, Patrick Bucher
Don't create pages with 3MB of Javascript, that's insane.
True
I think concatenation/bundling in one file is fine, but not minification,
because it makes the source unreadable. Carefully evaluate what you actually
use in the site. Don't use bloated Javascript (such as jQuery) and CSS frameworks
(such as Bootstrap).
jQuery looks almost reasonable nowadays, compared to the shitpile that
comes out of a Angular «Web App».
Make sure to "gracefully fallback" so Javascript is not required.
One of the latest trends in Javascript bundle compilation. For example have a
look at the new Reddit layout. There all the CSS classnames are randomized.
Must reduce the HTTP payload big time, especially when gzipped M-(
Stop this madness.
Yes, please!
Patrick
Manu Raster
2018-05-22 12:49:04 UTC
Permalink
While minimizing is a discipline of the programmer to keep things clear
and simple, what was presented here as "minifying" operates at the
deplorable result level, when it's too late for programmatic
corrections. It thus obfuscates instead of corrects failures.
Loading...