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

Unexpected behaviour. #25

Closed
The-Real-Thisas opened this issue Aug 28, 2022 · 4 comments
Closed

Unexpected behaviour. #25

The-Real-Thisas opened this issue Aug 28, 2022 · 4 comments

Comments

@The-Real-Thisas
Copy link

For some reason it insists on removing type="text" on inputs.

Now while I understand why it may do this as if your not specifying it as anything specific the generic fallback is text, but in my case it leads to this pretty annoying css bug for my contact page.


With Compress Active:

Screenshot 2022-08-28 at 9 14 22 PM

    <div class="col-12">
        <label class="js-input-group">Name <input data-required="" name="name" placeholder="Fill in your name" /> <span class="form__error"></span></label>
    </div>
    <div class="col-12">
        <label class="js-input-group">Email <input data-required="" name="email" placeholder="Fill in your email" /> <span class="form__error"></span></label>
    </div>

Without Compress:

Screenshot 2022-08-28 at 9 15 35 PM

    <div class="col-12">
        <label class="js-input-group">
            Name
            <input type="text" name="name" data-required="" placeholder="Fill in your name" />
            <span class="form__error"></span>
        </label>
    </div>

    <div class="col-12">
        <label class="js-input-group">
            Email
            <input type="text" name="email" data-required="" placeholder="Fill in your email" />
            <span class="form__error"></span>
        </label>
    </div>

I'm not really sure why it does this as I don't really see it doing much to reduce size.

Would it be possible to make this opt-out or opt-in in the config ?

@NikolaRHristov
Copy link
Member

NikolaRHristov commented Aug 28, 2022

You can try to remove removeRedundantAttributes from the settings in astro-compress:

astro.config.ts

import type { AstroUserConfig } from "astro";
import compress from "astro-compress";

export default (): AstroUserConfig => {
	return {
		integrations: [
			compress({
				html: {
					removeRedundantAttributes: false
				},
			}),
		],
	};
};

This is because the default value for a type attribute on an input element is text and is redundant.

@The-Real-Thisas
Copy link
Author

Ahhh right, this helped fix that issue.

@The-Real-Thisas
Copy link
Author

Thank you @NikolaRHristov

@NikolaRHristov
Copy link
Member

np

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants