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

inlinecss twig tag url encoding href #42

Open
icedevelopment opened this issue Dec 1, 2017 · 2 comments
Open

inlinecss twig tag url encoding href #42

icedevelopment opened this issue Dec 1, 2017 · 2 comments

Comments

@icedevelopment
Copy link

When using the inlinecss twig tag in a template, every href value is apparently url encoded by tijsverkoyen/css-to-inline-styles.

This was mentioned here and is particularly annoying when using special templating tags provided by MailChimp for example.

Example:

{% inlinecss 'path/to/stylesheet.css %}
    To unsubscribe, click <a href="*|UNSUB|*">here</a>.
{% endinlinecss %}

will result in the following HTML:

To unsubscribe, click <a href="*%7CUNSUB%7C*">here</a>.

instead of:

To unsubscribe, click <a href="*|UNSUB|*">here</a>.

How can we avoid this behavior?

@cordoval
Copy link
Member

cordoval commented Dec 1, 2017

what do you think is the reason to encode whatever is inside of the hrefs?

disregarding this, do you know if any other twig tree node parsing/rule does the same to the hrefs? or it is just this implementation?

I would say don't use it, and use the service and method calls. That is what i do.

@icedevelopment
Copy link
Author

According to the issue I mentioned, this encoding is done when calling DomDocument::saveHTML() so it's not related to twig. I'm not sure there is a way to configure DomDocument to leave href values unencoded.

I think there should be a warning in the docs regarding the use of inlinecss tags.

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