Otherwise, set `$develop_src` to `false`īut there’s another key to the code that’s left in the comments:.If so, then set `$develop_src` to `true`.If not, check to see if the `$GLOBALS` collection as `-src` defined in the `wp_version` value.Check to see if the `SCRIPT_DEBUG` constant has a definition.In short, the code is doing the following: If you look through the WordPress source code, you’ll find references to a constant: SCRIPT_DEBUG.įor example, wp-includes/default-constants.php has this code in Lines 69-79 (at the time of this post): So what’s the standard way to go about doing this? What if the theme or another plugin has opted to use the same flag? Wouldn’t this result in potentially causing something to happen that you didn’t expect? The problem with doing this is that you never know what side effects you may trigger when toggling your flag. Some ways that developers make it easy to toggle values are: That is, other themes and plugins may have their own flags and you may end up causing erratic results when trying to debug those files. The trouble with doing this in WordPress is that people may have their own ways of doing this. Ideally, you need to be able to toggle a flag that will load the un-minified files making it easier to trace code. Then again, we’re still saying it and people are still doing it. ![]() But when it’s time to deploy to Production, you should be aiming for a few minified files.įor example, say a client contacts you claiming something on their site isn’t working? You load up the site, you check the browser console and see there’s an error in the JavaScript.įirst, make sure Development is in sync with Production. If you use W3 Total Cache on your site, you can reduce load time by reducing the size and number of CSS and JS files using its minify feature.It’s one thing to have your JavaScript files separated and organized in your Development. The plugin comes with dozens of features including Minify. It takes your website performance to a new level. W3 Total Cache is one of the most popular caching plugin available in the market. Here I will minify CSS and javascript using some popular plugins. There are many ways and plugins available to reduce CSS and javascript. So let’s come directly to the main topic now… Here is a list – 17 Best Website Speed Checker Tools in 2019 There are many speed checker tools available in the market. To minify CSS and Javascript, first, you need to know what is the current score of your website. Page load speed is very important to get a higher rank in Google search and increase traffic to your blog. ![]() How to Minify CSS and Javascript in WordPress Site Also, Google recommends to Minify JavaScript and CSS files from a site.įaster loading website performs better in search engines result and also improve the user experience. So, minify CSS and Javascript is very crucial and helpful to make your site blazing fast. In simple words, it removes unwanted codes from your website. Minifying JavaScript, CSS, and HTML reduce the number of requests and page size of your site. What is Minify and Why It is so Important? How to Minify CSS and Javascript in WordPress Site. ![]()
0 Comments
Leave a Reply. |