Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Removing javascript comments

by renodino (Curate)
on Apr 09, 2008 at 23:39 UTC ( #679372=note: print w/ replies, xml ) Need Help??


in reply to Removing javascript comments

You might cheat from Dean Edward's packer implemented in Perl (and several other languages). It does a great deal more than just strip comments, but you can always run the output back thru a beautifier to reconstruct code layout.

Otherwise, I'd suggest looking into Text::Balanced, since parsing JS has many of the same gotchas as parsing Perl, notably, regex syntax that can contain stuff that looks like comments.


Perl Contrarian & SQL fanboy


Comment on Re: Removing javascript comments

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://679372]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2015-07-31 11:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (276 votes), past polls