Skip to content

Commit

Permalink
Harden workbox-js inclusion and removal of sourceMappingURL comment
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Jan 28, 2020
1 parent 5d226a0 commit 22605b4
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public function get_script() {
);
} else {
// Inline the workbox-sw.js to avoid an additional HTTP request.
$script .= file_get_contents( PWA_PLUGIN_DIR . '/' . $workbox_dir . 'workbox-sw.js' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
$script .= preg_replace( '://# sourceMappingURL=.+?\.map:', '', $script );
$wbjs = file_get_contents( PWA_PLUGIN_DIR . '/' . $workbox_dir . 'workbox-sw.js' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
$script .= preg_replace( '://# sourceMappingURL=.+?\.map\s*$:s', '', $wbjs );
}

$options = array(
Expand Down

0 comments on commit 22605b4

Please sign in to comment.