Skip to content
Draft
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
4 changes: 3 additions & 1 deletion packages/wp-build/templates/script-registration.php.template
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,7 @@ if ( ! function_exists( '{{PREFIX}}_register_package_scripts' ) ) {
}
}

add_action( 'wp_default_scripts', '{{PREFIX}}_register_package_scripts' );
// Priority 9 so that the Gutenberg plugin (priority 10) can override
// these scripts with newer versions when it is active.
add_action( 'wp_default_scripts', '{{PREFIX}}_register_package_scripts', 9 );
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this means Gutenberg won't override Core anymore?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In which case?

  • GB active: wp_default_scripts at 10 in GB will override this ones, which is what fixes the problem?
  • GB not active: wp-build scripts are active?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GB active: wp_default_scripts at 10 in GB will override this ones, which is what fixes the problem?

Gutenberg runs this template as well. So I thought gutenberg will also get 9 after this PR is merged.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, for what does GB use this? Don't we only use client-assets.php?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

client-assets is only for things that are not "refutal scripts or modules", overrides on top of it. Nowadays Gutenberg is almost full wp-build for its own scripts and modules.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. So could we check if we're in the GB plugin or not?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean if there's no other way sure but I wonder if we can find a generic way to make this work.

  • Gutenberg should override Core
  • Plugins should not override Gutenberg, they can override Core too

}
Loading