Today we continue our tutorial on W3TC. You probably already know that it is cache plugin, which allows you, among other things, to accelerate your blog (improves its performance).
This tutorial is broken down into several parts. We have since started with the introduction to the cache and made some preliminary adjustments. You can see the different chapters below:
- 1 part: Introduction to Cache
- Part 2: How to configure W3TC
- General Settings - Episode 1
- More General Settings - Episode 2
- Page Cache Configuration - 3 Episode
- Configuration of minifications - Episode 4 (Present tutorial)
- Database Cache Configuration - 5 Episode
- Object and Browser Configuration - Episode 6
- Part 3: All the answers to your questions
- Part 4: W3TC "Mainspan" Parameters
Part 2: Configuring minification
We are still in the configuration W3TC, but now let's talk about file compression.
Before accessing the menu Minify ", You must first activate" Minify In the general settings. If you have enabled the compression mode, and if it works properly on your site, then the settings for " minification That you see in this menu will be a simplified version of what is shown in the screenshots below.
In this tutorial, we cover the compression process ( minifying ) with W3TC. The " minification And the combination of JS and CSS are the essence of what we will see in this tutorial.
Minify: General
General settings in the menu Minify Has three options.
The module " URL Rewrite "Should be enabled by default and you should leave this option as such, unless you prefer to see your CSS and JS files fetched using" http GET "headers rather than the normal URL structure.
Disable " minification For logged in users should not be changed. It is recommended not to provide logged in and disconnected users with different CSS and JS files.
Error notification " Minify Must be set for administrator notifications. This will allow them to be informed when there is an error.
The following sections " All minify ", Combine and move the" page components "option. This can break the presentation of your site. You should enable preview mode and keep an eye on your site as you make changes to make sure you don't damage your site layout.
Minify: HTML & XML
The section " HTML and XML From the Minify menu is simple. The checkboxes are intended to allow " minification ", of the' " online CSS and JavaScript, omit minification streams, and allow breaking newlines.
With the exception of the option " Do not minify feeds Which must remain unchecked, your site speed should improve.
The text box of Ignored comments steams Is used to identify HTML comments that should not be removed when HTML is "compressed". Some linked comments will be in this domain by default in order to ensure that comments associated with Google AdWords and readers are not deleted. If your HTML code contains additional comments and you want to stay in the " minified Of HTML, add a term in this text box, so any comments with this expression will not be deleted.
Minify JS
If you have enabled compression JavaScript & CSS " in the menu " General Settings you will only be able to work with all the resources Both JavaScript and the menu you see will be a simplified version of the image below.
If you have selected the manual method, you must scroll to the top of the menu Minify And select the wizard button. The latter lists the JavaScript and CSS files detected by W3TC. Select check all boxes for both JavaScript and CSS file types and click on " Apply And close. This will add the JavaScript and CSS files in the menu " Minify So that you can work with these manually.
Look at the box named " Operation in areas ". In this section you can control whether the resources JavaScript are " minified And combined with the option Minify Or if they are simply combined. The type " Embed » offers some options for how resources JavaScript are loaded. You can try each of the options of “ nonblocking Until you find one that doesn't break your site's presentation, but if none of the options work, leave the defaults.
If you have selected the manual compression method in the general settings, you can work with each file individually by assigning it to a single template or to all templates and moving it to the " header ", the " body "Or below" body For granular control over where each file appears in the HTML document and how it is loaded. You can also " drag and drop »Files, to rearrange the order in which they are loaded in case some files depend on previous files to load correctly.
The optimal setting is to move the files from " header And load them one of the options of nonblocking "(Non-blocking). However, there is a very good chance that by doing this, the appearance of your site will be affected.
There is really no way around this by going through each file once, testing them in different places, and making sure the site loads correctly.
Minify CSS
There are four settings to reduce the available CSS files:
- Enable : Enables minfication and the combination of CSS files.
- combine only : Combine CSS files, but do not belittle them.
- Preserved how removal : Removes comments from combined CSS files.
- Line break removal: Removes newlines in combined CSS files.
Start by selecting all options except for " combines Only ". If the presentation of the site is different, uncheck " Preserved how removal " and " Line break removal ". If that does not correct the site, then use " combines Only ».
For the @import option, select " Our Process ».
If you selected " Cars As a method of minification "General settings, then you will only see the first two sections of this menu. However, if you have the minification Manual, then you will see a CSS file management section.
If you haven't already added CSS files that will be managed, select the "Help" wizard, and select all the CSS files for your themes. Then rearrange the order of the files so that the most critical files are loaded first.
Minify: Advanced settings
In most cases, the default settings in the advanced section do not need much editing. However, you can use them to adjust the frequency with which JavaScript and CSS files are updated, the frequency with which expired files are deleted from the cache, and more.
The advanced section includes three fields to exclude specific pages, JS files and CSS files from the " minification ". If you find that some JS or CSS resources should never be compressed, you can isolate them by adding them to these domains. If you need help with the correct syntax, see " Use: General From the FAQ for instructions.
That's it for the minification options on W3 Total Cache, we will continue with the database cache.
Hello, thank you for your explanations! However, I still cannot solve a problem: By doing an analysis with 'Pagespeed Insights' I found several errors (css resources which blocked my page) that I managed to solve by following your instructions indicated on this page. However there is 1 css file which still blocks the display and I cannot modify it because I cannot find it in the Minify menu. Could you help me ?
Hello,
For this type of assistance you must contact our team via the live chat on the home page of this site.
Hello
Thank you for this article very thorough about W3TC
I have a question. Yesterday, I updated my W3TC plugin which I have been using for a very long time and which has never given me a problem. Immediately I was unable to access WP-admin.
I managed to disable the plugin on FTP without going through WP-admin. And I regained my access to WP-admin
What do I conclude from all this?
Should I abandon W3TC?
Should I reinstall following your settings (mine were perhaps obsolete and update the sanctioned)
If I have to choose another cache plugin. Which one do you advise me?
Thank you for your answers
Hello,
So just having W3TC disabled by FTP doesn't necessarily mean it's the cause. Perhaps the latter (since he has never betrayed you) has encountered a conflict which is the cause of your problem.
I suggest you give the plugin another chance. But making sure you have fallbacks in case another problem arises. By fallback I am referring to backups of your blog.
Thank you
Herve thank you
In fact, I believe the real maintainer is not W3TC (which I am about to reinstall) but WPtouch. I then remembered that 2 updates were necessary
When I install WPtouch
this is what I get:
The extension could not be activated because it triggered a fatal error.
Parse error: syntax error, unexpected T_STRING in /home/aproposd/www/wp-content/plugins/wptouch/core/class-cache-smash.php on line 104
I do not know what that means
It's annoying
thank you for your reply
Hi,
there is a syntax problem in the "class-cache-smash" file of the wptouch plugin. I invite you to update if it is available, as you will not be able to use this plugin unless you ask for a quick service to fix this error.
Okay good ... I just installed W3TC and here is the message I get ...
The extension could not be activated because it triggered a fatal error.
Parse error: syntax error, unexpected T_STRING in /home/aproposd/www/wp-content/plugins/w3-total-cache/w3-total-cache.php on line 65
What should I do ? Can you help me ... it's hopeless
Hi Marie, I'm sorry to hear that you haven't solved your problem yet. We can help you, request personalized assistance via live chat on the home page of the site. We will give prompt help to your problem.