lukasleitsch / kirby-blade

Enable Laravel Blade Template Engine for Kirby 4
MIT License
17 stars 4 forks source link

[feature] HTML minification #12

Closed S1SYPHOS closed 2 years ago

S1SYPHOS commented 2 years ago

Hey there, as you may have guessed, after @afbora archiving his repository in favor of this one, all the feature-greedy people like me come over here and ask their pesky "plz add feature xy" questions - well, here goes! :grin:

Until Kirby implements some kind of 'template' hook for manipulating HTML after Template class was applied, I think you should offer it as it was - from what I understand, this was mostly due to the (somewhat extensive) documentation, but messing around with echo $kirby->render(); output to achieve this isn't very Kirby-like. Now, I'd be happy to provide a PR to add it back in and in the README just tell people to have a look at voku/htmlmin for documentation of its various options.

Let me know what you think, and sorry if this raises too many eyebrows, but I just had to ask :fox_face:

Cheers, S1SYPHOS

lukasleitsch commented 2 years ago

Hey,

yes, we removed the HTML minification due the overwhelming configuration and the few benefits. If your web server supports gzip to deliver the response, the generated PHP file shouldn't be an issue.

The scope of this plugin is to allow using Laravel Blade in Kirby. HTML minification should be provided by another plugin. Register the blade plugin via a template hook could be than the preferred way in the future.

Overwrite the Kirby template is currently the only way to register Blade.

An alternative could be to add a custom hook to allow other plugins to modify the compiled template. If this alternative could be a way for you, please provide a PR.

S1SYPHOS commented 2 years ago

Custom hook sounds reasonable, so people may apply whatever minification engine or whatnot - I'll try to whip something up 🙃

S1SYPHOS commented 2 years ago

Let me know if there's anything else before merging this, glad to contribute to this project!

lukasleitsch commented 2 years ago

Merged and released.

https://github.com/lukasleitsch/kirby-blade/releases/tag/2.3.0