-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a dedicated assets class for connection assets
- Loading branch information
1 parent
d26a3cd
commit 636ef04
Showing
5 changed files
with
46 additions
and
24 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
projects/packages/connection/src/class-connection-assets.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* Connection_Assets. | ||
* | ||
* @package automattic/jetpack-connection | ||
*/ | ||
|
||
namespace Automattic\Jetpack\Connection; | ||
|
||
use Automattic\Jetpack\Assets; | ||
|
||
/** | ||
* Connection_Assets class. | ||
*/ | ||
class Connection_Assets { | ||
|
||
/** | ||
* Initialize the class. | ||
*/ | ||
public static function configure() { | ||
add_action( 'wp_loaded', array( __CLASS__, 'register_assets' ) ); | ||
} | ||
|
||
/** | ||
* Register assets. | ||
*/ | ||
public static function register_assets() { | ||
if ( ! wp_script_is( 'jetpack-connection', 'registered' ) ) { | ||
|
||
Assets::register_script( | ||
'jetpack-connection', | ||
'../dist/jetpack-connection.js', | ||
__FILE__, | ||
array( | ||
'in_footer' => true, | ||
'textdomain' => 'jetpack-idc', | ||
) | ||
); | ||
|
||
Initial_State::render_script( 'jetpack-connection' ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters