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

Remove HTML comments from template (minifying) #1274

Open
Pique7 opened this issue Oct 11, 2023 · 5 comments
Open

Remove HTML comments from template (minifying) #1274

Pique7 opened this issue Oct 11, 2023 · 5 comments

Comments

@Pique7
Copy link

Pique7 commented Oct 11, 2023

Hello,
What would be an appropriate method to remove HTML comments from my templates when they are rendered?
I haven't found anything about it in the documentation.

I tried \Template::instance()->extend() but this does not work with HTML comments.

I also found View::afterrender() but I don't know whether might be helpful and how to utilize it. I am not that familiar with PHP and F3.

@httpneo
Copy link

httpneo commented Oct 11, 2023

Use the exclude Tags: <exclude><!-- HTML Comment --></exclude>

@geniuswebtools
Copy link

Here's the link to the documenation:
https://fatfreeframework.com/3.8/views-and-templates#ExclusionofSegments

@Pique7
Copy link
Author

Pique7 commented Oct 11, 2023

Oh, I really overlooked this in the documentation because I was focused on removing existing <!-- HTML comments -->.
I think for my case the provided solution is acceptable. I can replace/complement all my comments with the <exclude> tag.
Okay, thanks for your help!

@pauljherring
Copy link

Meanwhile, on the subject of minification, there is some functionality in core, but it's only for js and css:

@Pique7
Copy link
Author

Pique7 commented Oct 11, 2023

Meanwhile, on the subject of minification, there is some functionality in core, but it's only for js and css:

* https://fatfreeframework.com/3.8/optimization#KeepingJavascriptandCSSonaHealthyDiet

* https://fatfreeframework.com/3.8/web#minify

Yes, initially I hoped this could be an answer to my problem but ironically my project barely contains custom CSS and JavaScript (yet).
As already mentioned, for now the solution provided by @httpneo and @geniuswebtools seems to be suitable.

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

4 participants