Skip to content

Commit

Permalink
@sjoerdlinders we'll have to put this behind a default false filter: …
Browse files Browse the repository at this point in the history
…$minified_url can also be false if the file is minified already (as per filename). emptying $new_tag for those results in the non-aggregated CSS not being preloaded if "inline & defer" is on.
  • Loading branch information
futtta committed May 28, 2020
1 parent 750d2fc commit ec26681
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions classes/autoptimizeScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,9 @@ public function read( $options )
if ( ! empty( $minified_url ) ) {
// Replace original URL with minified URL from cache.
$new_tag = str_replace( $url, $minified_url, $new_tag );
} else {
// Remove the original script tag, because cache content is empty.
} elseif ( apply_filters( 'autoptimize_filter_ccsjs_remove_empty_minified_url', false ) ) {
// Remove the original script tag, because cache content is empty but only if filter
// is trued because $minified_url is also false if original JS is minified already.
$new_tag = '';
}
}
Expand Down
5 changes: 3 additions & 2 deletions classes/autoptimizeStyles.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,9 @@ public function read( $options )
if ( ! empty( $minified_url ) ) {
// Replace orig URL with cached minified URL.
$new_tag = str_replace( $url, $minified_url, $tag );
} else {
// Remove the original style tag, because cache content is empty.
} elseif ( apply_filters( 'autoptimize_filter_ccsjs_remove_empty_minified_url', false ) ) {
// Remove the original style tag, because cache content is empty but only if
// filter is true-ed because $minified_url is also false if file is minified already.
$new_tag = '';
}
}
Expand Down

0 comments on commit ec26681

Please sign in to comment.