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

split_lines should be *after* comments inserting #20

Open
homm opened this issue Sep 24, 2014 · 2 comments
Open

split_lines should be *after* comments inserting #20

homm opened this issue Sep 24, 2014 · 2 comments

Comments

@homm
Copy link

homm commented Sep 24, 2014

I have a issue with split_lines. After splitting (and before inserting comments) code became:

code,code,"yUglify: preserved comment block"
,code,code

I.e. code wraps right after comment. After than replacing comments replaces "preserved comment block" without comma. As a result code become:

code,code,
/* comment
*/
,code,code

I.e. two commas are following each other (with comment between). This causes the error.

You should swap split_lines and code.replace(reTokens, …).

@Feuermurmel
Copy link

I'm seeing a similar problem here with yuglify@0.1.4:

a();
/*!*/
if (a) {
  throw a;
}

The above gets minified to this, which is not valid JavaScript:

a(),
/*!*/
;if(a)throw a

@natevw
Copy link
Contributor

natevw commented Oct 12, 2017

Running into something similar. Still diving in to the details here, but I wonder if #17 would be an alternate fix?

natevw added a commit to natevw/yuglify that referenced this issue Oct 17, 2017
…ad of a custom regex one. this should fix a number of open issues (probably yui#19 and yui#20; not sure about yui#21)
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