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

mergeScripts should insert semicolons between <script> tags #55

Closed
jordanbtucker opened this issue Aug 2, 2018 · 3 comments
Closed

Comments

@jordanbtucker
Copy link

With the following HTML and default options:

<script>document.write('Hello, ')</script><script>document.write('World!')</script>

It should produce:

<script>document.write('Hello, ');document.write('World!');</script>

But instead you get the following error:

Error: SyntaxError: Unexpected token: name (document)

So it appears that it is concatenating the two <script> tags as this (without a semicolon in between):

<script>document.write('Hello, ')document.write('World!')</script>

If you put the semicolon there yourself, mergeScripts does something even stranger. It replaces it with a comma:

<script>document.write('Hello, ');</script><script>document.write('World!')</script>

becomes

<script>document.write('Hello, '),document.write('World!');</script>

The comma is valid, but it does seem an odd choice over a semicolon.

@maltsev
Copy link
Member

maltsev commented Aug 3, 2018

Thanks for the bug report! I fixed it. I'll release a new version today.

@maltsev
Copy link
Member

maltsev commented Aug 3, 2018

If you put the semicolon there yourself, mergeScripts does something even stranger. It replaces it with a comma:

Actually, that is a result of minifyJs optimization. If you disable it ; shouldn't be replaced with , in that case.

@maltsev
Copy link
Member

maltsev commented Aug 3, 2018

Released: 0.1.10.

@maltsev maltsev closed this as completed Aug 3, 2018
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