Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #6273 Exclude JS module type from minification #6277

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions inc/Engine/Optimization/Minify/JS/AbstractJSOptimization.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ protected function is_minify_excluded_file( array $tag ) {
false !== strpos( $tag[0], 'data-minify=' )
||
false !== strpos( $tag[0], 'data-no-minify=' )
||
preg_match( '/type=(?<quote>[\'"])module\g<quote>/', $tag[0] )
) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<script type="text/javascript" src="http://example.org/wp-content/themes/twentytwenty/assets/script.js"></script>
<script type="text/javascript" src="http://example.org/wp-content/plugins/hello-dolly/script.js"></script>
<script type="text/javascript" src="http://example.org/wp-includes/js/jquery/jquery.js"></script>
<script type="module" src="http://example.org/wp-content/module.js"></script>
</head>
<body>
</body>
Expand All @@ -29,6 +30,7 @@
<script data-minify="1" type="text/javascript" src="http://example.org/wp-content/cache/min/1/wp-content/themes/twentytwenty/assets/script.js?ver={{mtime}}"></script>
<script data-minify="1" type="text/javascript" src="http://example.org/wp-content/cache/min/1/wp-content/plugins/hello-dolly/script.js?ver={{mtime}}"></script>
<script type="text/javascript" src="http://example.org/wp-includes/js/jquery/jquery.js"></script>
<script type="module" src="http://example.org/wp-content/module.js"></script>
</head>
<body>
</body>
Expand Down Expand Up @@ -59,6 +61,7 @@
<script data-minify="1" type="text/javascript" src="https://123456.rocketcdn.me/wp-content/cache/min/1/wp-content/themes/twentytwenty/assets/script.js?ver={{mtime}}"></script>
<script data-minify="1" type="text/javascript" src="https://123456.rocketcdn.me/wp-content/cache/min/1/wp-content/plugins/hello-dolly/script.js?ver={{mtime}}"></script>
<script type="text/javascript" src="http://example.org/wp-includes/js/jquery/jquery.js"></script>
<script type="module" src="http://example.org/wp-content/module.js"></script>
</head>
<body>
</body>
Expand Down
Loading