Hello I want to make my site to load faster. I done page speed with GTmetrix and here is one of major problems: "This page has 25 external Javascript scripts. Try combining them into one. This page has 8 external stylesheets. Try combining them into one.” How I can combine Javascripts to one file and .css to another one file? I understand that I need copy for example Javascript files to one master js file, for example master.js. But where and how, and in to what files than I will need to change address where will be located my master.js file. Thanks
you copy and paste their contents into their respective files. That's all there is to it. You do know how to cut and paste using a text editor, right? THOUGH, 25 javascripts and 8 stylesheets is a MASSIVE warning sign that how the site was built is most likely rubbish; likely endless copy and paste from different sources and most likely a bunch of bloated idiotic frameworks for nothing... If it's loading slow all that is a direct contributor to the problem, and just combining the fat bloated pointless code into single files is more of a case of sweeping deep rooted issues under the rug instead of actually fixing the problems. If you use the web developer toolbar for FF https://addons.mozilla.org/en-US/firefox/addon/web-developer/ under "information -> document size" how big is your base document? How many separate files and what are the total compressed and uncompressed size. Your file counts ALONE from what you've said is telling me that unless the site is VERY special, it probably needs to be thrown out completely and started over from scratch if you care about accessibility, speed, or ease of maintenance. If I took a look at the actual site, I could probably tell you more -- but it most likely suffers from ten times the CSS needed thanks to some stupid framework and endless pointless javascript for nothing. That also probably means by extension non-semantic markup, bloated markup and a whole host of other issues -- it just goes with the territory. Those MAY be assumptions -- but as educated guesses go...
Size Uncompressed Size 6 Documents 46 KB 208 KB 28 Images 114 KB 114 KB 0 Objects 26 Scripts 250 KB 773 KB 8 Style Sheets 30 KB 152 KB 68 Files 440 KB 1248 KB
Yeah, that's ... disturbingly large; for most websites that's three times as many files and ten times as much total filesize as should be needed -- 152k of CSS for ANY site is some serious heavy duty whiskey tango foxtrot -- calling the entire page construction method into question; that there are six documents total (meaning iframes) sure as shine-ola isn't helping, and could also mean there are files being loaded that tool in FF can't even see! (meaning the page is even LARGER than that). Even compressed it's three to four times larger in filesizes than I'd make a page uncompressed. Makes me wonder about your content too -- how many of those images are actually content? How much actual plaintext is on that page? Those numbers confirm it though -- even sight unseen I can say with 100% certainty the entire layout and code of that site really needs to be pitched in the bin if you actually care about speed, ease of maintenance, and accessibility -- as it's guaranteed you lack all three. Sorry if that sounds harsh, but that's the reality of it. Dimes to dollars a proper page containing the same basic content has no excuse to break 140k in 24 files TOTAL... and it could be as small as half that if one really takes the time to do it right; though that's a guess without seeing the actual site in question. Lemme guess... Turdpress? Doped to the gills with mods/extensions? The typical halfwit "I can haz intarnets" markup that goes with it like: <body id="top" class="single single-post postid-116 single-format-standard responsive-menu"> <div id="wrapper"> <div class="bg"> </div> <div class="w1"> <div id="header"> <div class="holder holder-panel clearfix"> <div class="frame"> <div class="panel"> <ul id="nav" class="menu"><li id="menu-item-35" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-35"> Code (markup): Which if you don't know what's wrong with it, one shouldn't have a website?
My website is: http://www.findwebsite.net How I can combine these javascrips? If I will copy paste to one file, how then system will know where this big javascript is located?
To actually do it, you just cut/paste them into a single file with a text editor (at least the ones served from your domain), then go into the template and remove their LINK or SCRIPT tags to replace them with a single one of each -- BUT. Looking at what's there, I'd swing an axe at 90%+ of the sites codebase. You've fallen into the trap a lot of site owners do of thinking that turdpress developers have any clue how to build a website, that jQuery offers anything of value, and that the idiotic halfwit steaming pile of manure known as bootstrap does anything other than piss all over your website's speed and accessibility. Removing those and all the 'scripting for nothing' could easily drop the page size 60% or more; but that would also mean throwing everything else away and starting over from scratch. Though that too would be my advice; gut it and start over from scratch as there is NOTHING on that site I'd even TRY to salvage other than it's content. The plaintext and content image count alone illustrates how badly built the whole thing is; combining scripts and CSS in this case is like trying to repair a hole in the Hoover Dam with bailing wire and chewing gum. That page has 5k of plaintext and nine actual content images... A real world guesstimate puts that at an ideal of around 10k of markup and given how simple the layout is the entire site shouldn't need more than 32k of CSS. I'm not even seeing anything that warrants the PRESENCE of javascript -- but you have 52k of HTML, 152k of CSS and an unearthly pointless 479k of javascript... If I had written that same page, it would likely not even break 96k total, and the majority of that would be the images. When you have six times as much javascript as you do content images on a page that -- to be frank -- isn't doing anything that warrants the presence of javascript... you've got problems. Though that's par for the course when you abuse a blogging system like turdpress to build a non-blog website, then slap garbage like bootstrap and jQuery on it. It's just a laundry list of how not to build a website. Combining those files together is the LEAST of your problems; and would be little more than sweeping deep rooted issues in how the site was created under the rug.