Skip to content

Commit

Permalink
Merge branch 'master' of github.com:xwp/pwa-wp into tweak/integration…
Browse files Browse the repository at this point in the history
…s-flag

* 'master' of github.com:xwp/pwa-wp: (24 commits)
  Remove unused global console
  Include missing base_url when precaching scripts & styles
  tweak check for $manifest['icons']
  phpcs & phpunit fix
  PHP 5.2 compatibility & remove superfluous condition. See #118
  Upgrade Workbox to 4.0.0-beta.2
  Upgrade workbox-cli to 4.0.0-beta.2
  Another one for #118
  Add extra meta for iOS
  Another one for #122
  IIFE for #122
  fixes #122
  Update wp-includes/service-workers.php
  Ensure legacy caching strategy factory names convert to class names
  Replace factory invocation of strategies with class instantiation
  Update skipWaiting and clientsClaim to use core namespace
  Upgrade Workbox to v4.0.0-beta.1
  Bump workbox-cli to 4.0.0-beta.1
  Fix code style
  Fix code style
  ...
  • Loading branch information
westonruter committed Feb 4, 2019
2 parents e1d136a + 641b831 commit f732221
Show file tree
Hide file tree
Showing 63 changed files with 3,218 additions and 1,581 deletions.
5 changes: 5 additions & 0 deletions integrations/class-wp-service-worker-scripts-integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,16 @@ public function register( WP_Service_Worker_Scripts $scripts ) {

$url = $dependency->src;

if ( is_string( $url ) && ! preg_match( '|^(https?:)?//|', $url ) && ! ( wp_scripts()->content_url && 0 === strpos( $url, wp_scripts()->content_url ) ) ) {
$url = wp_scripts()->base_url . $url;
}

$revision = false === $dependency->ver ? get_bloginfo( 'version' ) : $dependency->ver;

/** This filter is documented in wp-includes/class.wp-scripts.php */
$url = apply_filters( 'script_loader_src', $url, $handle );

// @todo Issue a warning when it is not a local file?
if ( $url && $this->is_local_file_url( $url ) ) {
$scripts->precaching_routes()->register( $url, $revision );
}
Expand Down
7 changes: 6 additions & 1 deletion integrations/class-wp-service-worker-styles-integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,17 @@ public function register( WP_Service_Worker_Scripts $scripts ) {

$url = $dependency->src;

if ( is_string( $url ) && ! preg_match( '|^(https?:)?//|', $url ) && ! ( wp_styles()->content_url && 0 === strpos( $url, wp_styles()->content_url ) ) ) {
$url = wp_styles()->base_url . $url;
}

$revision = false === $dependency->ver ? get_bloginfo( 'version' ) : $dependency->ver;

/** This filter is documented in wp-includes/class.wp-styles.php */
$url = apply_filters( 'style_loader_src', $url, $handle );

if ( $url && $this->is_local_file_url( $url ) ) {
// @todo Issue a warning when it is not a local file?
if ( is_string( $url ) && $this->is_local_file_url( $url ) ) {
$scripts->precaching_routes()->register( $url, $revision );
}
}
Expand Down
Loading

0 comments on commit f732221

Please sign in to comment.