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

compression escape + javascript - problem #10

Open
spagu opened this issue Jul 5, 2018 · 2 comments
Open

compression escape + javascript - problem #10

spagu opened this issue Jul 5, 2018 · 2 comments

Comments

@spagu
Copy link

spagu commented Jul 5, 2018

I have a javascript added to the template and function is doing wrong minification:

$('#auto').append('<tr id="auto_'+data.auto_id+'}}"><td>'+data.auto_movie+'</td><td><div class="form-check checkbox-slider--a checkbox-slider-md"><label>....

basically it sees it as HTML.

I tried to escape compression but I am getting error 'endhtmlcompress' is not found when inside template I put it twice.

start file here

{% htmlcompress %}
(include) HTML to be compressed
{% endhtmlcompress %}
(include) HTML NOT TO BE COMPRESSED
{% htmlcompress %}
(include) REST OF HTML TO BE COMPRESSED
{% endhtmlcompress %}

Any Idea how to work it out ?

@nochso
Copy link
Owner

nochso commented Jul 5, 2018

wrong minification

This package is only a Twig extension, the actual compression is done by WyriHaximus/HtmlCompress and the packages it uses.

I tried to escape compression but I am getting error 'endhtmlcompress' is not found when inside template I put it twice.

I can't reproduce it. Consecutive {% htmlcompress %} tags work fine. Are you nesting the htmlcompress tags in the includes maybe? I haven't tested that.

@madsem
Copy link

madsem commented Sep 23, 2018

Make sure your script tag includes type="text/javascript"
Just adding this fixed the issues I was seeing.

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

3 participants