oupala/apaxy

Minimise html/css/js

filipopo opened this issue · 4 comments

Is your feature request related to a problem? Please describe.
There are some code blocks that do nothing (presumably to easily find what to edit when doing customization's), for example:

apaxy/apaxy/theme/style.css

Lines 172 to 174 in 98ebe81

/* 3rd Column: Last Modified */
th + th + th {
}

and here:
} else {
//pressed key is a non-char
//e.g. 'esc', 'backspace', 'up arrow'
}

This technically slows down the page loading but for a better effect all of the white space should be removed, and a good minifier will remove empty blocks as well

e.g Using https://cssminifier.org/ I was able to reduce style.css from 8.3KiB to 6.0KiB and it removed the empty block

Describe the solution you'd like
Since the theme is basically preprocessed when installing, terser (for js) or some other tool could be invoked in the script to minify the files, maybe into new ones e.g style.min.css and to keep the originals

Describe alternatives you've considered
Maybe just including the minified versions in the repo and potentially defaulting to them

Thank you Fhilip for this issue.

I globally agree with the idea that serving minified resource files is better for performance. It is however detrimental to readability. There is therefore a compromise to be found between performance and readability.

In your example, the css selector is there to be easy to be customized, as it is for the js extract. There is therefore a compromise to be found between performance, readability and customizability.

I consider apaxy to be a base project to be customized according your particular needs and preferences.

Do you see any solution that could be a good compromise between performance, readability and customizability.

Hey @oupala, I think the solution to have non minified versions of files turn into minified versions is a pretty good compromise allowing for customization and readability before and after installation.

Alternatively maybe a coding style could be adopted that uses less whitespace, all the indentation in the html files could be removed as they're pretty small

apaxy is a piece of software that should be pretty ready to use without a full installation process. That's why I want to keep an unoptimized version of files by default.

Indentation of html files is usefull for readability. Removing them is not a solution.

The only solution that I'm seeing is adding an optional step in the configuration script apaxy-configure.sh that could be used to minify resource files. However, this script is currently mainly doing some mv and some sed commands. Do you know any way to minify css, js and html file with bash?

oupala commented

Closing issue after long inactivity.

Feel free to reopen if you want to.