You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
8000
Invalid minified output when minifying Jinja template (brace_template_syntax) #232
<select>
<option value="first" <% if condition {%>selected<% }%>>First</option>
</select>
output
<select><option <% condition if value=first {%>;selected<% }%>>First</option></select>
There seems to be clever ways to progressively work around the issue. For example, removing the space before the template closing tag prevents some of the distortion highlighted in the earlier example, and I can actually get the above code to work if I change the order of the attributes. However, none of those fixes feel elegant and reliable. It feels like relying on quirks in the code. I am also not sure if any of this is intended behavior, so I am hoping that someone more familiar with the project could offer some guidance here.
Activity
Zaczero commentedon Apr 11, 2025
It appears that the parser doesn't recognize template syntax in attribute part. This is likely the same issue as #183.
Zaczero commentedon Apr 11, 2025
Seems like the comments are also broken when placed as attributes and keep_comments=True
AshfordN commentedon Apr 21, 2026
I am experiencing this problem as well with the sailfish syntax. My command, input and output are shown below.
command
minhtml --keep-closing-tags --preserve-chevron-percent-template-syntax input.stplinput.stpl
output
There seems to be clever ways to progressively work around the issue. For example, removing the space before the template closing tag prevents some of the distortion highlighted in the earlier example, and I can actually get the above code to work if I change the order of the attributes. However, none of those fixes feel elegant and reliable. It feels like relying on quirks in the code. I am also not sure if any of this is intended behavior, so I am hoping that someone more familiar with the project could offer some guidance here.