Skip to content

How-to Guides

Technical References

VIP Platform /

File concatenation and minification

By default, VIP concatenates JavaScript and CSS files in an effort to reduce the number of requests a single page requires. CSS is not only concatenated but also minified which reduces the file size by removing unnecessary white space. If you minify files in your theme, as part of a build process, you should also include the source files for code review.

The responses that are generated by VIP sites are served from our global network of edge locations. This means a majority of a site’s traffic, including concatenated scripts and styles, can be served directly from the edge location closest to your visitors, without ever hitting a line of PHP. This results in the low-latency and high-performance impact expected from a CDN.

Note

Some 3rd party performance scans may not recognize our CDN since the files are being served from the same domain as your site.

Cache duration

Enqueued JavaScript and CSS are concatenated on VIP Go and cached for 15 days.

For additional information on caching you may be interested in learning how VIP handles page caching.

Versioning to bust the cache

The cache can be busted for concatenated JS and CSS by incrementally updating the $ver value when changes are made to the enqueued, or registered, resources using functions like wp_enqueue_script(), wp_enqueue_style(), wp_register_script(), and wp_register_style().

// When changes are made to js/plugin.js the $ver variable should be incrementally updated.
$ver = '1.1';
wp_enqueue_script( 'plugin_script', plugins_url( 'js/plugin.js', __FILE__ ), array(), $ver );

Note

Because of the container-based infrastructure, VIP does not recommend using the function filemtime() to populate a value for $ver; each time a container is created it would result in a different value.

Disable concatenation

If you have a need to disable concatenation on a VIP site, add the following constant to your vip-config.php file.

define( 'CONCATENATE_SCRIPTS', false );

Last updated: December 29, 2020