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

minify strips PHP tags #5748

Closed
ghost opened this issue Mar 11, 2019 · 5 comments · Fixed by #11765
Closed

minify strips PHP tags #5748

ghost opened this issue Mar 11, 2019 · 5 comments · Fixed by #11765

Comments

@ghost
Copy link

ghost commented Mar 11, 2019

Steps to Reproduce

Add following line to a template:
{{ readFile "path/file" | safeHTML }}

run hugo --minify
--> This part gets ommited, when using the --minify flag on hugo.

when you run just hugo everything is fine.

How I came up with that:

I am including a php snippet for a contact form into a hugo template. Without the use of safeHTML <?php gets translated to &lt;?php.

@ghost ghost changed the title minify flag safeHTML content minify flag ommits safeHTML content Mar 11, 2019
@stale
Copy link

stale bot commented Nov 2, 2019

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@stale stale bot added the Stale label Nov 2, 2019
@bep bep added the Keep label Nov 2, 2019
@stale stale bot removed the Stale label Nov 2, 2019
@moorereason moorereason changed the title minify flag ommits safeHTML content minify flag omits safeHTML content Dec 1, 2020
@moorereason
Copy link
Contributor

The upstream minifier Hugo uses doesn't handle PHP tags. See tdewolff/minify#35 (comment)

@moorereason moorereason changed the title minify flag omits safeHTML content minify strips PHP tags Dec 1, 2020
@bep bep added the Bug label Dec 1, 2020
@bep bep added this to the v0.80 milestone Dec 1, 2020
@bep bep modified the milestones: v0.80, v0.81 Jan 2, 2021
@bep bep modified the milestones: v0.81, v0.82 Feb 19, 2021
@bep bep modified the milestones: v0.82, v0.83 Mar 21, 2021
@bep bep modified the milestones: v0.83, v0.84 May 1, 2021
@bep bep modified the milestones: v0.84, v0.85 Jun 18, 2021
@bep bep modified the milestones: v0.85, v0.86 Jul 5, 2021
@bep bep modified the milestones: v0.86, v0.87, v0.88 Jul 26, 2021
@bep bep modified the milestones: v0.88, v0.89 Sep 2, 2021
@raspopov
Copy link

raspopov commented Oct 9, 2021

Are there any workaround for such problem? Looks like a blocking error for using PHP inside HUGO templates with --minify.

@bep bep modified the milestones: v0.110.0, v0.111.0 Jan 26, 2023
@bep bep modified the milestones: v0.111.0, v0.112.0 Feb 15, 2023
@bep bep modified the milestones: v0.112.0, v0.113.0 Apr 15, 2023
@bep bep modified the milestones: v0.113.0, v0.115.0 Jun 13, 2023
@bep bep modified the milestones: v0.115.0, v0.116.0 Jun 30, 2023
@bep bep modified the milestones: v0.116.0, v0.117.0 Aug 1, 2023
@bep bep modified the milestones: v0.117.0, v0.118.0 Aug 30, 2023
@bep bep modified the milestones: v0.118.0, v0.119.0 Sep 15, 2023
@bep bep modified the milestones: v0.119.0, v0.120.0 Oct 4, 2023
@bep bep modified the milestones: v0.120.0, v0.121.0 Oct 31, 2023
jmooring added a commit to jmooring/hugo that referenced this issue Nov 29, 2023
jmooring added a commit to jmooring/hugo that referenced this issue Nov 29, 2023
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants