a-r-m-i-n / min

TYPO3 CMS extension "min" - Compressed CSS, JS and HTML output for TYPO3
7 stars 8 forks source link

Do not override global `config.compress*` and `config.concatenate*` #15

Open LeoniePhiline opened 1 year ago

LeoniePhiline commented 1 year ago

The current version (v2.1) overwrites global configuration config.compress* and config.concatenate* which might often be against the interest of the user, as today's assets are mostly bundled, minified and prepared for long-term caching strategies by other tools.

The documentation already contains the hint to add these yourself: https://docs.typo3.org/p/t3/min/2.1/en-us/Configuration.html#asset-compression-css-js

Including modifications to global config { ... } together with other, plugin-specific configuration makes it cumbersome to handle complex configuration trees, where global config is, among other basic settings, configured before extension configuration is included.

I would propose either removing the config section from the extension TypoScript configuration entirely, or splitting it off into a separate, includable static TypoScript file.

PS: As website author / extension user, not including the provided TypoScript configuration is not a good option either: This raises the maintenance burden, as all relevant non-config settings need to manually be kept in sync when extension updates introduce new or change existing settings.

a-r-m-i-n commented 1 year ago

Hello @LeoniePhiline, thanks for your response and your proposal.

The documentation part you've referenced to, basically describes, what you get, when you include the static TypoScript template of EXT:min. Now, you have the ability to include the TypoScript manually. In earlier versions, this TypoScript config has been applied always, automatically.

So, when you include the static TypoScript, you probably expect the extension to be enabled. And to do so, I have to add the config.compress* and config.concatinate* options.

I don't see the need to outsource the config. settings to a seperate static include file. What would be the benefit?

Maybe the documentation should get adjusted instead. What do you think?

LeoniePhiline commented 1 year ago

Hi! Thanks for your response!

The benefit would be that integrators can use the HTML minification feature provided by the extension, without being forced to also use the asset compression and concatenation.

These are distinct features, and should be enabled using two distinct TypoScript includes.

It is quite common to build, bundle and minify assets with tools like parcel, vite, esbuild, webpack etc.

Users of these tools only want html minification, but their (already optimized) assets left untouched.

Users of these tools are not going to want an extension fiddling with global config settings. ;)

I hope you can consider splitting the two features (html minification vs assets minification) into two separate TypoScript includes. :)

In any case, I found your extension very useful. Thank you for publish it!

a-r-m-i-n commented 1 year ago

Ahh, I understand. One TypoScript file for asset compression and one for source code (formerly known as tinysource). This makes sense to me and indeed makes it easier to just use one of those features.

Let me think a bit about it...

LeoniePhiline commented 1 year ago

I'd greatly appreciate it. ;)