Skip to content

Commit dc6637d

Browse files
committed
Auto-exclude cdn.jsdelivr.net & cdnjs.cloudflare.com from the JS minification
1 parent 28d5bb2 commit dc6637d

File tree

1 file changed

+31
-29
lines changed

1 file changed

+31
-29
lines changed

inc/functions/minify.php

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php
22
defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
33

44
/**
@@ -39,12 +39,12 @@ function rocket_fetch_and_cache_minify( $url, $pretty_url ) {
3939
if ( ! is_dir( $cache_path ) ) {
4040
rocket_mkdir_p( $cache_path );
4141
}
42-
42+
4343
// Apply CDN on CSS properties
4444
if( strrpos( $pretty_path, '.css' ) ) {
45-
$content = rocket_cdn_css_properties( $content );
45+
$content = rocket_cdn_css_properties( $content );
4646
}
47-
47+
4848
// Save cache file
4949
if( rocket_put_content( $pretty_path, $content ) ) {
5050
return true;
@@ -80,7 +80,7 @@ function get_rocket_minify_files( $files, $force_pretty_url = true, $pretty_file
8080
foreach ( $files as $file ) {
8181
$file = parse_url( $file, PHP_URL_PATH );
8282
$file = trim( $file );
83-
83+
8484
if ( empty( $file ) ) {
8585
continue;
8686
}
@@ -205,28 +205,28 @@ function get_rocket_minify_excluded_external_js() {
205205
*
206206
* @param array Hostname of JS files to exclude
207207
*/
208-
$excluded_external_js = apply_filters( 'rocket_minify_excluded_external_js', array(
209-
'forms.aweber.com',
210-
'video.unrulymedia.com',
211-
'gist.github.com',
212-
'stats.wp.com',
213-
'stats.wordpress.com',
214-
'www.statcounter.com',
215-
'widget.rafflecopter.com',
216-
'widget-prime.rafflecopter.com',
217-
'widget.supercounters.com',
218-
'releases.flowplayer.org',
219-
'tools.meetaffiliate.com',
220-
'c.ad6media.fr',
221-
'cdn.stickyadstv.com',
222-
'www.smava.de',
223-
'contextual.media.net',
224-
'app.getresponse.com',
225-
'ap.lijit.com',
226-
'adserver.reklamstore.com',
227-
's0.wp.com',
228-
'wprp.zemanta.com',
229-
'files.bannersnack.com',
208+
$excluded_external_js = apply_filters( 'rocket_minify_excluded_external_js', array(
209+
'forms.aweber.com',
210+
'video.unrulymedia.com',
211+
'gist.github.com',
212+
'stats.wp.com',
213+
'stats.wordpress.com',
214+
'www.statcounter.com',
215+
'widget.rafflecopter.com',
216+
'widget-prime.rafflecopter.com',
217+
'widget.supercounters.com',
218+
'releases.flowplayer.org',
219+
'tools.meetaffiliate.com',
220+
'c.ad6media.fr',
221+
'cdn.stickyadstv.com',
222+
'www.smava.de',
223+
'contextual.media.net',
224+
'app.getresponse.com',
225+
'ap.lijit.com',
226+
'adserver.reklamstore.com',
227+
's0.wp.com',
228+
'wprp.zemanta.com',
229+
'files.bannersnack.com',
230230
'smarticon.geotrust.com',
231231
'js.gleam.io',
232232
'script.ioam.de',
@@ -244,7 +244,9 @@ function get_rocket_minify_excluded_external_js() {
244244
'app.ecwid.com',
245245
'www.industriejobs.de',
246246
's.gravatar.com',
247+
'cdn.jsdelivr.net',
248+
'cdnjs.cloudflare.com',
247249
) );
248-
249-
return $excluded_external_js;
250+
251+
return $excluded_external_js;
250252
}

0 commit comments

Comments
 (0)