Skip to content

Commit

Permalink
Merge pull request #89 from kucrut/pr-77-fixes
Browse files Browse the repository at this point in the history
PR 77 fixes
  • Loading branch information
kucrut authored Jun 13, 2024
2 parents 77d96bc + b7b96a3 commit 4d62c7e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/kind-frogs-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@kucrut/vite-for-wp': patch
---

Fix script type modifier. Props irshadahmad21
8 changes: 4 additions & 4 deletions vite-for-wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ function set_script_type_attribute( string $target_handle, string $tag, string $

$processor = new WP_HTML_Tag_Processor( $tag );

$script_fount = false;
$script_found = false;

do {
$script_fount = $processor->next_tag( 'script' );
} while ($processor->get_attribute( 'src' ) !== $src );
$script_found = $processor->next_tag( 'script' );
} while ( $processor->get_attribute( 'src' ) !== $src );

if ( $script_fount ) {
if ( $script_found ) {
$processor->set_attribute( 'type', 'module' );
}

Expand Down

0 comments on commit 4d62c7e

Please sign in to comment.