-
Nov 17th, 2019, 01:32 AM
#1
Thread Starter
PowerPoster
How to compress JS code to the minimum size with VB6?
My web pages need to call some JavaScript code, which has 10-20 thousand lines. In order to increase the speed of loading web pages, I want to compress these JavaScript code to the minimum size with VB6. I'd like to know if there is any good way to achieve this? Thanks!
-
Nov 17th, 2019, 01:44 AM
#2
Re: How to compress JS code to the minimum size with VB6?
Isn't the first cut to gzip the file?
Beyond that you probably need a parser/analyzer that can build a symbol table, then rewrite the script using short variable names and squeezing out white space including comments.
There might be more tricks, but I'm not sure why you'd come to a VB forum to ask any of this. Sounds more like a question for the JS forum here. The challenges should be the same no matter what you program in.
Python forums are big on code handouts and all of the cool kids are there. You might try some of those, they seem to be a dime a dozen.
-
Nov 17th, 2019, 11:28 AM
#3
Hyperactive Member
Re: How to compress JS code to the minimum size with VB6?
Would keeping the java script on the server work
-
Nov 17th, 2019, 06:59 PM
#4
Re: How to compress JS code to the minimum size with VB6?
Originally Posted by dreammanor
My web pages need to call some JavaScript code, which has 10-20 thousand lines. In order to increase the speed of loading web pages, I want to compress these JavaScript code to the minimum size with VB6. I'd like to know if there is any good way to achieve this? Thanks!
I wouldn't recommend building something with VB6 (or any VB) to do this ... Look at minify and jscompress.... if you google "javascrip minify" they should be the first couple of results. They're existing tools that do exactly what you're looking for. I've used miniify before - not directly, but as part of a built process, and it does a pretty good job of shrinking things down.
-tg
-
Nov 18th, 2019, 10:42 AM
#5
Thread Starter
PowerPoster
Re: How to compress JS code to the minimum size with VB6?
Originally Posted by dilettante
Isn't the first cut to gzip the file?
Beyond that you probably need a parser/analyzer that can build a symbol table, then rewrite the script using short variable names and squeezing out white space including comments.
There might be more tricks, but I'm not sure why you'd come to a VB forum to ask any of this. Sounds more like a question for the JS forum here. The challenges should be the same no matter what you program in.
Python forums are big on code handouts and all of the cool kids are there. You might try some of those, they seem to be a dime a dozen.
Hi dilettante, thank you for your reply.
I know that writing a JS parser/analyzer can solve the problem completely, and I've always wanted to do this (write a JS parser/analyzer with pure VB), but I hope to find some clever solutions. Writing the parser/analyzer in the traditional way is not only a lot of work, but also has little practical value.
I hope that all processing of JS can be done with VB6, so I put the question in the VB6 forum.
-
Nov 18th, 2019, 10:42 AM
#6
Thread Starter
PowerPoster
Re: How to compress JS code to the minimum size with VB6?
Originally Posted by Ordinary Guy
Would keeping the java script on the server work
Hi Ordinary Guy, thank you for your reply. My JS code is used to process the client's web pages. As for the server-side work, I still want to use VB6 and RC5 to handle it.
-
Nov 18th, 2019, 10:43 AM
#7
Thread Starter
PowerPoster
Re: How to compress JS code to the minimum size with VB6?
Originally Posted by techgnome
I wouldn't recommend building something with VB6 (or any VB) to do this ... Look at minify and jscompress.... if you google "javascrip minify" they should be the first couple of results. They're existing tools that do exactly what you're looking for. I've used miniify before - not directly, but as part of a built process, and it does a pretty good job of shrinking things down.
-tg
Hi techgnome, the tool you recommend is great. But my web pages are dynamically generated by my web tools, and JS code needs to change dynamically, so I need to use VB6 to write a JS minifier for my web tools. Thank you, techgnome.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|