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

dont work if url in script #13

Open
arnold-b opened this issue May 23, 2024 · 4 comments
Open

dont work if url in script #13

arnold-b opened this issue May 23, 2024 · 4 comments

Comments

@arnold-b
Copy link

arnold-b commented May 23, 2024

just try this to minify
if (item) { let copyText = "https://www.xxx.com/index.html?itemno="+item.value; navigator.clipboard.writeText(copyText); }
after // the minifier will cut all because he interpret this as comment
minify result: let copyText = "https:navigator.clipboard.writeText(copyText);}}

@zoffixznet
Copy link
Owner

You may be using an outdated version of the module. When I minify your example with fresh module install from CPAN, it comes out fine:

perl -MJavaScript::Minifier -wlE '                                                                                                                                                            
    say "Using module version " . $JavaScript::Minifier::VERSION;                                                                                                                                                                          
    say "Minified code: " . minify(input => q|if (item) { let copyText = "https://www.xxx.com/index.html?itemno="+item.value; navigator.clipboard.writeText(copyText); } |);                                                               
'                                                                                                                                                                                                                                          
Using module version 1.16                                                                                                                                                                                                                  
Minified code: if(item){let copyText="https://www.xxx.com/index.html?itemno="+item.value;navigator.clipboard.writeText(copyText);}

@arnold-b
Copy link
Author

JavaScript::Minifier

    (no description)
    Z/ZO/ZOFFIX/JavaScript-Minifier-1.16.tar.gz
    /usr/local/share/perl/5.34.0/JavaScript/Minifier.pm
    Installed: 1.16
    CPAN:      1.16  up to date
    Zoffix Znet (ZOFFIX)
    zoffixcpan@gmail.com

@arnold-b
Copy link
Author

arnold-b commented May 27, 2024 via email

@zoffixznet
Copy link
Owner

What output do you get when you run this code snippet:

perl -MJavaScript::Minifier -wlE '                                                                                                                                                            
    say "Using module version " . $JavaScript::Minifier::VERSION;                                                                                                                                                                          
    say "Minified code: " . minify(input => q|if (item) { let copyText = "https://www.xxx.com/index.html?itemno="+item.value; navigator.clipboard.writeText(copyText); } |);                                                               
'                                                                                                                                                                                                                                          

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