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

Request: removeHttpPrefix to remove https (also to work with srcset attribute) #43

Closed
abuyoyo opened this issue Feb 5, 2020 · 3 comments

Comments

@abuyoyo
Copy link
Contributor

abuyoyo commented Feb 5, 2020

What is this feature about (expected vs actual behaviour)?

  1. Allow removing of https: as well as http: prefixes.
    I believe this should be done by the existing function. A single function that removes both schemes is optimal IMO.

  2. Also remove prefix from srcset attribute as well as src attribute.
    This is technically a separate issue but it's all to do with the same hunk of code.

Does it take minutes, hours or days to fix?

It takes a few seconds to fix.

@voku
Copy link
Owner

voku commented Feb 6, 2020

"single function that removes both schemes"

But then you will have problems with links, if you're currently using "http", so all links also will use "http", please test what you are doing :)

PS: I added "doRemoveHttpsPrefixFromAttributes()"

  1. srcset is also implemented for "http" and "https": 61ae49b

changes are available in version 4.1.0

@voku voku closed this as completed Feb 6, 2020
@abuyoyo
Copy link
Contributor Author

abuyoyo commented Feb 23, 2020

Thank you.
I'll look into it now.

Slightly related question:
Removing the shema prefix (be it http or https ) from links is technically destructive to the information in href/rel=external anyway. As opposed, in a sense, to removing the schema prefix from resources used by the actual html page being processed (scripts, img tags etc.)

So perhaps an option should be made available - so as to be able to clear (either) schema from page resources without altering href/external links. Just a thought. Not relevant to my use-case. I can manage with the above change.

Also, would you consider an option similar to removePrefix, something like makeRelative. An option to minify all same-server links by making them relative, ie. those prefixed $_SERVER['SERVER_NAME'] (and the same schema?) could be filtered to be relative. This would be considered a non-destructive minification option.

@voku
Copy link
Owner

voku commented Feb 23, 2020

@abuyoyo I like your idea, maybe you can create a pull request for this change?

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

2 participants