Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to minify html output #411

Closed
Pok4 opened this issue Mar 12, 2023 · 4 comments
Closed

Option to minify html output #411

Pok4 opened this issue Mar 12, 2023 · 4 comments

Comments

@Pok4
Copy link

Pok4 commented Mar 12, 2023

Can you add a option to minify html ?
Or can you tell me a variant for this ?
Thank you in advance!

@bobthecow
Copy link
Owner

Minifying HTML is an entirely separate concern. You should probably pass the output of mustache to a library made for that :)

@Pok4
Copy link
Author

Pok4 commented Mar 13, 2023

Give me example please. Here (https://www.geeksforgeeks.org/how-to-minify-html-code-of-php-page/amp/) is simple php code for minify. If you have time, please give me example..

@bobthecow
Copy link
Owner

I have no experience with HTML minification in PHP, but I'd find a library (maybe HtmlMin? ¯\_(ツ)_/¯) and look at its docs to see how to use it. I bet it looks something like this:

$m = new Mustache_Engine(...);
$html = $m->render(...);
$htmlMin = new HtmlMin();
echo $htmlMin->minify($html);

@Pok4
Copy link
Author

Pok4 commented Mar 13, 2023

Thank you, it works!

@Pok4 Pok4 closed this as completed Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants