I tried a couple of Minify plugins but none of them seem to minify javascrips or css. I rather not install W3C because i only need a minify plugin. Browser caching in enabled trough nginx on my vps and WP Super Cache so i don’t need all other caching functions that come with W3C. Any ideas why minify does not seem to work?
Hello,
for javascript we already have the minified versions in js/min . For the rest of the site I would not recomment that you minify the html. It provides minimum gains. Also our users are using the mod_pagespeed plugin for apache (i think there is a version for nginx too).
And how about css? Pagespeed said that i could save 20% by minifying style.css, but no minify plugin will minify the themes css file. Is the tagDiv Speed Booster plugin included in the version 2.2? And i never seen anyone mention mod_pagespeed plugin on this forum, what does it so?
r1kay
to clarify, mod_pagespeed is not a WordPress plugin, but is used at the server level and is being used by many “speed oriented” web hosting providers now, including many that specialize in WP hosting specifically (and larger folk like GoDaddy, etc.).
The easy way to minify your main style.css file, is to
1) in your theme folder, make a copy of the style.css file (rename style-bak.css or whatever)
2) take the style.css file and open in a text editor (NOT a word processor), like Notepad or TextPad on Windows, or similar.
3) copy and paste all the text from the file into a minifcation online tool like one of these:
– http://refresh-sf.com/yui/
– http://cssminifier.com/
4) copy the “minified” output into a new style.css file
5) upload via FTP to over-write the style.css file in your theme root
Now when you run PageSpeed Insights it won’t bug you anymore. I do this and works just fine.
If none of that is remotely possible for you to do, then don’t stress over it. You only gain maybe a point for doing this, along with a couple of other things. Image optimization is far more important, and limiting use of plugins which “dial out” from your site to load things on the page beyond your content (social media “counters” for instance – plain buttons load faster).
You likely haven’t seen mention of mod_pagespeed as you have not been looking through the “pinned” topic at top of forum on “Pagespeed” issues.
Note when minifying the css file, it will save 20% of the space, but it doesn’t speed anything up by 20% or improve rating by 20%. If it saves more than 20kb then it’s worth it. If it saves less than 20kb may not be worth the trouble.
ALSO: be aware each time you update theme you will need to re-compress the style sheet using one of the tools above.
Hope that helped.
Thanks Christopher. I took a look at mod_pagespeed, but it doesnt look like it could do anything for me at this point. I’m already on a VPS that runs Plesk 11 with nginx as a reverse proxy. I’m letting nginx handle all php scripts and serve static and dynamic content. Gzip compression is enabled and i enabled browser caching through nginx with the expiration set to two weeks. I’m running WP Super Cache as well to create pre cached pages and i use EWWWW Image Optimizer to optimize all images. I also optimazed all theme and plugin images with that plugin. You might want to look it up, imo it really is a better plugin than smush.it and so. I use the simple minify plugin to minify all javascripts and i my pagespeed currently toggles between 85 en 92 for desktop, depending on my server response time and between 70 and 80 for mobile. The only red warning i still get is to defer javascript and css (moste google fonts, and 3 theme css files: bootstrap, style.css and child theme style.css) to below the fold, but i have no experience on how to do that. Im really pleased with the pagespeed right now, but more tips (besides using a CDN) are welcome!
Thanks for you responce anyway 🙂
We own our own server, so we’re running mod_pagespeed on Plesk[ne Parallels]11/CentOS6.5 in order to solve some things across different types of content sites (not all WordPress). Being able to defer javascript with WP is helpful. Being able to recompress images at server level, combine small PNGs to sprites, etc. mean we don’t have to use Smush.it, EWWWW, etc. for most things. Using the built-in WordPress compression level function to make thumnbails generate at “50” vs “80” also a big help before anything else is done. Idea is trying to run stuff at server level above the PHP stuff where possible vs having plugins being called as each page renders. Nice thing with mod_pagespeed is also inserted image dimensions for “responsive” images for faster page render. E.g., on one of our sites the images are 400×300, but render on page at 70% of the column “width” via CSS — mod_pagespeed will actually rewrite the actual size on page (e.g., 431xNNN) for faster page load. Some really interesting stuff. We run memcache and are storing cached elements in RAM and on the disk, before the page write – so, in theory, this is a level above using a cache “plugin” in some ways (although end result is same probably).
Still testing 🙂 Just got a good working version across all sites as of Tues. night (two days ago). 10 days of “try this, nope. try that, nope. WTf? Oh! What? Hey! Oh. Okay…” … 😉
Seems like you should already be able to minify the .css for the main style sheet if you know all that stuff ! Kind of surprised Super Cache isn’t able to minify.
But sounds like you’re an above average user, so likely you’ll be able to come up with a solution for the CSS minification if you don’t want to do it manually.
I’m suffering an 82/100 desktop at the moment due to addthis, google syndication/adsense, and youtube video on a page. 92+ with that noise off and no cache plugin (!).
We stripped out the Google font calls entirely, and did search/replace in style.css for default fonts. Got rid of the stupid Google insights “error” for their own stupid fonts.
It’s a process. Since we have a shiny new 12 core Xeon server, been trying to get this tweaked to do as much as possible at top. Considering adding Varnish, but another pain in the butt to sort out. Day 16 of the “how much can the server do to fix stuff on the fly” adventure. Would be nice if Google fixed their own crap for Insights to at least give a reasonable speed grade taking into account THEIR problems.
No magic bullet. Funny how some “experts” who claim 100 pagespeed are running sites with plain text, no graphics and one ad on page, and then try to give advice for those running newspaper/magazine sites which by nature are very complex.
Some our sites generate 2+ million page views per month and have been online 14 years with 230,000 inbound sites for pagerank. We have been managing our own servers since 1996, and ran a hosting company from 1996-2005. We did Oprah Winfrey’s ecom solution for her “Begin with Love” videos a decade ago. Pretty savvy. We are also PCI-DSS certified, and have weathered serious server attacks so have complex security stuff in place. ‘=)
We do use nginx along with Apache 2.2 – for instance phpmyadmin runs on nginx. 32GB of RAM, dedicated 1GB switch at SoftLayer in Texas. Power to burn. Replaced our 2008 server with 12GB RAM and 8 cores. Wild times compared to the days of, say Cobalt RaQ4 (google it).
Still playing with mod_pagespeed stuff as they have lots of cool things like “inline_google_font_css” (Inlines small CSS files used by fonts.googleapis.com into the HTML document.) which I’ve not yet been able to get working. Defer javasceript is another one built-in which is cool.
Stable version from November, edge version from January, and you can’t mix ’em.
Anyway… I’m trying to find the balance of the traditional hacks
1) mods to the wp-config.php
2) mods to functions.php
3) mods to htaccess (Apache)
4) manual optimization of css file if a rewrite system breaks it
5) upload best practice optimized images to begin with; generate smaller thumbs to start with using built-in compression of WordPress vs plugin for initial files; remove duplicate sizes in media setup to match theme size
6) use mod_pagespeed to manage cache (with memcache, eAccelerator, APC, etc.); rewrite on the fly to cache copies with comments removed, delete white space (instant minification!); combine CSS, combine JS, etc.
6) when all that fails to keep a “92” dump the CSS/JS onto the CDN, keep images local.
This is my mission for January. Once done, I’ll have a better sense of what actually works and what is truly a fool’s errand.
BTW: my friends at GTMetrix have a nice plugin for WordPress for testing/tracking pagespeed adventures (recommended!).
MOre later in the pagespeed “forum” here 🙂
I will probably end up doing some kind of ebook for this whole shenanigans.
Chris
-
This reply was modified 12 years by
simchris.
