-
Notifications
You must be signed in to change notification settings - Fork 36
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
style="background-image[...]
becoming style=background:[...]
#170
Comments
The quotes cause this issue. Need an option to disable removing quotes for attributes on the minify-html on end. |
Hi @SettingDust , thank you for responding. I included a slight typo when I originally posted, which I've now corrected to make the situation more clear, but I don't think it changes anything. So, thank you for your patience, and please bear with me while I try to elaborate. This is a real example, taken from the issue that I'm seeing: <div
class="{{ aspect_ratio }} w-full bg-cover bg-center"
style="background-image:url('/img/illustrations/rocket-ship.svg')"
></div> When minify is off this works as expected But when minify is on this does not work as expected I read the README you sent, but with my typo corrected I don't think that is applicable here. However, just to be safe, I tried thing with the typo still in place (and removing the quotes like you said), and the problem is still there. Furthermore, I ran the code through the recommended validator and there was no issue like that brought up. However, I do see a potential cause of my issue in the README: ### Attributes
Any entities in attribute values are decoded, and then the shortest representation of the value is calculated and used:
- Double quoted, with any `"` encoded.
- Single quoted, with any `'` encoded.
- Unquoted, with `"`/`'` first character (if applicable), any `>`, and any whitespace encoded. According to this <!-- minify off -->
<div
class="aspect-square w-full bg-cover bg-center"
style="background-image:url('/img/illustrations/rocket-ship.svg')">
</div>
<!-- minify on -->
<div
class="aspect-square w-full bg-cover bg-center"
style="background:url('/img/illustrations/rocket-ship.svg')">
</div> In this particular example, this change results not merely in a syntactic different but an actual semantic difference. I believe the correct minifcation would be to leave the same semantic meaning in place, which is to do nothing since there is no way to make Now that I've explained that does that make the issue more clear? Sorry for the typo earlier, Thanks for taking the time to read this. |
Hello, I'm using zola for a project, and I'm running into an issue with its minify, which I think uses minify-html.
The issue I was having came when using CSS and style attributes simultaneously, specifically
style="background-image:url('{{ slide.thumb.src }}')"
, while using other CSS to control the other aspects of the background image (like position, size, etc...). I thinkminify-html
(or is it lightningcss?) changesbackground-image
tobackground
, but in this case it's not just minifying but changing the meaning, since thestyle
attribute will override the CSS, and thebackground
property is short hand for all background properties expressed together.For now I have a workaround by just turning of minification, but I wanted to come here and ask if there's any advice? Maybe there's a setting or something that I can submit upstream to Zola? Thank you.
The text was updated successfully, but these errors were encountered: