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

Consistently prefix script/style handles #12847

Merged
merged 3 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 1 addition & 1 deletion includes/Admin/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Dashboard extends Service_Base {
/**
* Script handle.
*/
public const SCRIPT_HANDLE = 'wp-dashboard';
public const SCRIPT_HANDLE = 'web-stories-dashboard';

/**
* Admin page hook suffixes.
Expand Down
2 changes: 1 addition & 1 deletion includes/Admin/Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Editor extends Service_Base implements HasRequirements {
/**
* Web Stories editor script handle.
*/
public const SCRIPT_HANDLE = 'wp-story-editor';
public const SCRIPT_HANDLE = 'web-stories-editor';

/**
* AMP validator script handle.
Expand Down
4 changes: 2 additions & 2 deletions includes/Admin/TinyMCE.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class TinyMCE extends Service_Base {
/**
* Web Stories tinymce script handle.
*/
public const SCRIPT_HANDLE = 'tinymce-button';
public const SCRIPT_HANDLE = 'web-stories-tinymce-button';

/**
* Assets instance.
Expand Down Expand Up @@ -147,7 +147,7 @@ public function web_stories_mce_plugin( $plugins ) {
if ( ! \is_array( $plugins ) ) {
return $plugins;
}
$plugins['web_stories'] = $this->assets->get_base_url( 'assets/js/tinymce-button.js' );
$plugins['web_stories'] = $this->assets->get_base_url( 'assets/js/' . self::SCRIPT_HANDLE . '.js' );
swissspidy marked this conversation as resolved.
Show resolved Hide resolved

return $plugins;
}
Expand Down
2 changes: 1 addition & 1 deletion includes/Renderer/Stories/Carousel_Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Carousel_Renderer extends Renderer {
/**
* Script handle.
*/
public const SCRIPT_HANDLE = 'carousel-view';
public const SCRIPT_HANDLE = 'web-stories-carousel';

/**
* Perform initial setup for object.
Expand Down
2 changes: 1 addition & 1 deletion includes/Renderer/Stories/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ abstract class Renderer implements RenderingInterface, Iterator {
/**
* Web Stories stylesheet handle.
*/
public const LIGHTBOX_SCRIPT_HANDLE = 'lightbox';
public const LIGHTBOX_SCRIPT_HANDLE = 'web-stories-lightbox';

/**
* Number of instances invoked. Kept it static to keep track.
Expand Down
4 changes: 2 additions & 2 deletions web-stories.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ function web_stories_get_compat_instance() {
$compatibility->set_wp_version( WEBSTORIES_MINIMUM_WP_VERSION );
$compatibility->set_required_files(
array(
WEBSTORIES_PLUGIN_DIR_PATH . '/assets/js/wp-story-editor.js',
WEBSTORIES_PLUGIN_DIR_PATH . '/assets/js/wp-dashboard.js',
WEBSTORIES_PLUGIN_DIR_PATH . '/assets/js/web-stories-editor.js',
WEBSTORIES_PLUGIN_DIR_PATH . '/assets/js/web-stories-dashboard.js',
WEBSTORIES_PLUGIN_DIR_PATH . '/assets/js/web-stories-block.js',
WEBSTORIES_PLUGIN_DIR_PATH . '/includes/vendor/autoload.php',
WEBSTORIES_PLUGIN_DIR_PATH . '/third-party/vendor/scoper-autoload.php',
Expand Down
10 changes: 5 additions & 5 deletions webpack.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ const sharedConfig = {
},
};

const EDITOR_CHUNK = 'wp-story-editor';
const DASHBOARD_CHUNK = 'wp-dashboard';
const EDITOR_CHUNK = 'web-stories-editor';
const DASHBOARD_CHUNK = 'web-stories-dashboard';

// Template for html-webpack-plugin to generate JS/CSS chunk manifests in PHP.
const templateContent = ({ htmlWebpackPlugin, chunkNames }) => {
Expand Down Expand Up @@ -384,8 +384,8 @@ const editorAndDashboard = {
const webStoriesScripts = {
...sharedConfig,
entry: {
lightbox: './packages/stories-lightbox/src/index.js',
'carousel-view': './packages/stories-carousel/src/index.js',
'web-stories-lightbox': './packages/stories-lightbox/src/index.js',
'web-stories-carousel': './packages/stories-carousel/src/index.js',
},
plugins: [
...sharedConfig.plugins,
Expand Down Expand Up @@ -467,7 +467,7 @@ const widgetScript = {
const storiesMCEButton = {
...sharedConfig,
entry: {
'tinymce-button': './packages/tinymce-button/src/index.js',
'web-stories-tinymce-button': './packages/tinymce-button/src/index.js',
},
plugins: [
...sharedConfig.plugins,
Expand Down