0

Dear pals,

I have an online app site which need 11 JS files including jQuery & D3.js files. I need to compress it into a single file and it's easy to use . I check some but need node.js and complex stuffs. I found http://jscompress.com/ but it's not working Application error in web site . Please advise a solution.

Thanks,
Anes

Edited by pritaeas: Fixed markdown. This forum does NOT use BBCode.

4
Contributors
13
Replies
46
Views
3 Years
Discussion Span
Last Post by chinusfashion
0

try out www.blimptontech.com
Very similar to jscompress but actually works, is running on UglyfyJS2 and is regularlly updated. The file combine feature rocks as well.

HTH

Edited by dingoellis

0

Dear dingoellis,
I check your URL and test . I have 11 js files so I upload all and try . But I got a very small file and it's not included the content of jQuery and some other files . When I test the code using that JS got error of "undefined" stuffs . So I believe it's not good for multiple files .

Please advise .

Thanks,
Anes

0

Without seeing the actual files you are trying to compress I would not be able to guess why it did not work for you.

I just tested it with a bunch of files on test site I have and it combined them all for me, and had no issue using the combined file. I have also used it a few other times as well and not hit an issue.

Could it possibly be a syntax error in the actual code before you try and minify it? Will dig out an old site that I know has around 20 js files and will try combinging them to see if there is an issue.

0

Dear dingoellis,
any way it's not problem of used files . For your reference I attach all the
files with this post . please check and advise me .

Thanks,
Anes

1

Well before I even start I can tell you that trying to run minified code through a minifier like UglyfyJS will only cause you many heartaches. So try again only using all non minified sources.

If you still have problems after that post the zip with all non minified code and I will give it a shot.

0

@Dingo, that is 99% going to be the cause of the problem
files already minified individually and cant be stitched together
too many files for speed, by http protocol 2 at a time
@logicslab I use jspretty to un-minify javascript files, then the text versions will stitch together and minify on any of the prior mentioned minifiers

other ways to speed up http

create subdomains pointing to the same folder structure
http can dl 2 files each from 3 domains concurrently
2 from www.mysite.com
2 from ww2.mysite.com
2 from ww3.mysite.com
where all three subdomains point to the html_root and you rotate the href in the <script> tags between www,ww2,ww3
instead of only 2 from www

enable mod_DEFLATE or mod_gzip for .html .php .css .js files in .htaccess,

Edited by almostbob

0

@almostbob Yes I get that, that is why I told @logicslab that is where to start seeing why he is having issues.

I would not unminify concatednated sources, you should always have a production version and dev version. Since you will loose your variable naming when its concatenated. Jspretty and similar "prettifier" type programs will not give you the same source as before it was concatenated.

Edit:
I just finished my test of an old site with lots of JS files 21 total to be exact. It is now running off a single file and had no issues with combining them all.

So @logicslab first try using non-minified sources and try again. That should solve everything for you.

Edited by dingoellis: Added info about a test I did.

0

He is using 3rd party production code, the Jquery library

If it wasnt downloaded to his site, but used the distribution href as recommended, then the files would 99% likely be in the browser cache from other user's implementation, and there is no time lost to download.
But the op did not read the instructions then, so I assumed they would not want to be told "ya shoulda" now
so
@logicslab. Ya Shoulda:
the Jquery library is used a lot, it is normally referenced in scripts from its distribution site at google code, then the file is going to be already in the user's cache and you dont have to reload it
the identical file referenced from a different Href, requires downloading again
the corrected script reference to the jquery library is

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
If you feel you must do it yourself, with all the penalties that incurs for time and portability, goto jquery.com and download the uncompressed/development version

Edited by almostbob

0

I agree that would be the best way to solve his third party code. I just assumed he did not want to since he was trying to minify all that into a singular file. I would do the same as your suggestion for JQuery.

Then any others that are third party that can not be done that way once unminified can be combined.

1

Dear dingoellis,almostbob:
I can understand the case of jQuery , I plan to make it as separate in CDN . that's good . So only 7 files need to make single one . i.e utils.js, tooltip.js, lineChart.js, legend.js, discreteBar.js,discreteBarChart.js , axis.js from the attached file list .

May I test it and give feedback .

Thanks alot @dingoellos & @almostbob

Anes

0

Dear dingoellis,
I create a new file as u suggest now , rough checked feel it include ALL files content . I will test that in my office and let you know result. I attach my resultant js of (utils.js, tooltip.js, lineChart.js, legend.js, discreteBar.js,discreteBarChart.js , axis.js)
as common.js here

Thanks,
Anes

Edited by logicslab: To attach missing file

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.