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

Update/asset loading #281

Draft
wants to merge 4 commits into
base: trunk
Choose a base branch
from
Draft
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
7 changes: 6 additions & 1 deletion mu-plugins/10up-plugin/src/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace TenUpPlugin;

use TenupFramework\Assets\GetAssetInfo;
use TenupFramework\Module;
use TenupFramework\ModuleInterface;
use TenUpPlugin\Traits\GetAssetInfo;

/**
* Assets module.
Expand All @@ -19,7 +19,7 @@
class Assets implements ModuleInterface {

use Module;
use GetAssetInfo;

Check failure on line 22 in mu-plugins/10up-plugin/src/Assets.php

View workflow job for this annotation

GitHub Actions / build

Class TenUpPlugin\Assets uses unknown trait TenupFramework\Assets\GetAssetInfo.

/**
* Can this module be registered?
Expand All @@ -36,6 +36,11 @@
* @return void
*/
public function register() {
$this->setup_asset_vars(

Check failure on line 39 in mu-plugins/10up-plugin/src/Assets.php

View workflow job for this annotation

GitHub Actions / build

Call to an undefined method TenUpPlugin\Assets::setup_asset_vars().
dist_path: TENUP_PLUGIN_PATH . 'dist/',
fallback_version: TENUP_PLUGIN_VERSION
);

add_action( 'admin_enqueue_scripts', [ $this, 'admin_scripts' ] );
add_action( 'admin_enqueue_scripts', [ $this, 'admin_styles' ] );
}
Expand All @@ -49,8 +54,8 @@
wp_enqueue_script(
'tenup_plugin_admin',
TENUP_PLUGIN_URL . 'dist/js/admin.js',
$this->get_asset_info( 'admin', 'dependencies' ),

Check failure on line 57 in mu-plugins/10up-plugin/src/Assets.php

View workflow job for this annotation

GitHub Actions / build

Call to an undefined method TenUpPlugin\Assets::get_asset_info().
$this->get_asset_info( 'admin', 'version' ),

Check failure on line 58 in mu-plugins/10up-plugin/src/Assets.php

View workflow job for this annotation

GitHub Actions / build

Call to an undefined method TenUpPlugin\Assets::get_asset_info().
true
);
}
Expand All @@ -65,7 +70,7 @@
'tenup_plugin_admin',
TENUP_PLUGIN_URL . 'dist/css/admin-style.css',
[],
$this->get_asset_info( 'admin', 'version' ),

Check failure on line 73 in mu-plugins/10up-plugin/src/Assets.php

View workflow job for this annotation

GitHub Actions / build

Call to an undefined method TenUpPlugin\Assets::get_asset_info().
);
}
}
45 changes: 0 additions & 45 deletions mu-plugins/10up-plugin/src/Traits/GetAssetInfo.php

This file was deleted.

6 changes: 5 additions & 1 deletion themes/10up-block-theme/src/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace TenupBlockTheme;

use TenupFramework\Assets\GetAssetInfo;
use TenupFramework\Module;
use TenupFramework\ModuleInterface;
use TenupBlockTheme\Traits\GetAssetInfo;

/**
* Assets module.
Expand All @@ -19,7 +19,7 @@
class Assets implements ModuleInterface {

use Module;
use GetAssetInfo;

Check failure on line 22 in themes/10up-block-theme/src/Assets.php

View workflow job for this annotation

GitHub Actions / build

Class TenupBlockTheme\Assets uses unknown trait TenupFramework\Assets\GetAssetInfo.

/**
* Can this module be registered?
Expand All @@ -36,6 +36,10 @@
* @return void
*/
public function register() {
$this->setup_asset_vars(

Check failure on line 39 in themes/10up-block-theme/src/Assets.php

View workflow job for this annotation

GitHub Actions / build

Call to an undefined method TenupBlockTheme\Assets::setup_asset_vars().
dist_path: TENUP_BLOCK_THEME_DIST_PATH,
fallback_version: TENUP_BLOCK_THEME_VERSION
);
add_action( 'init', [ $this, 'scripts' ] );
add_action( 'init', [ $this, 'register_all_icons' ], 10 );
add_action( 'wp_enqueue_scripts', [ $this, 'styles' ] );
Expand All @@ -51,8 +55,8 @@
wp_enqueue_script(
'frontend',
TENUP_BLOCK_THEME_TEMPLATE_URL . '/dist/js/frontend.js',
$this->get_asset_info( 'frontend', 'dependencies' ),

Check failure on line 58 in themes/10up-block-theme/src/Assets.php

View workflow job for this annotation

GitHub Actions / build

Call to an undefined method TenupBlockTheme\Assets::get_asset_info().
$this->get_asset_info( 'frontend', 'version' ),

Check failure on line 59 in themes/10up-block-theme/src/Assets.php

View workflow job for this annotation

GitHub Actions / build

Call to an undefined method TenupBlockTheme\Assets::get_asset_info().
[
'strategy' => 'defer',
]
Expand All @@ -69,7 +73,7 @@
'tenup-theme-styles',
TENUP_BLOCK_THEME_TEMPLATE_URL . '/dist/css/frontend.css',
[],
$this->get_asset_info( 'frontend', 'version' )

Check failure on line 76 in themes/10up-block-theme/src/Assets.php

View workflow job for this annotation

GitHub Actions / build

Call to an undefined method TenupBlockTheme\Assets::get_asset_info().
);
}

Expand Down
6 changes: 5 additions & 1 deletion themes/10up-block-theme/src/Blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace TenupBlockTheme;

use TenupFramework\Assets\GetAssetInfo;
use TenupFramework\Module;
use TenupFramework\ModuleInterface;
use TenupBlockTheme\Traits\GetAssetInfo;

/**
* Blocks module.
Expand All @@ -36,6 +36,10 @@ public function can_register() {
* @return void
*/
public function register() {
$this->setup_asset_vars(
dist_path: TENUP_BLOCK_THEME_DIST_PATH,
fallback_version: TENUP_BLOCK_THEME_VERSION
);
add_action( 'init', [ $this, 'register_theme_blocks' ], 10, 0 );
add_action( 'init', [ $this, 'enqueue_theme_block_styles' ], 10, 0 );
}
Expand Down
45 changes: 0 additions & 45 deletions themes/10up-block-theme/src/Traits/GetAssetInfo.php

This file was deleted.

6 changes: 5 additions & 1 deletion themes/10up-theme/src/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace TenUpTheme;

use TenupFramework\Assets\GetAssetInfo;
use TenupFramework\Module;
use TenupFramework\ModuleInterface;
use TenUpTheme\Traits\GetAssetInfo;

/**
* Assets module.
Expand All @@ -36,6 +36,10 @@ public function can_register() {
* @return void
*/
public function register() {
$this->setup_asset_vars(
dist_path: TENUP_THEME_DIST_PATH,
fallback_version: TENUP_THEME_VERSION
);
add_action( 'wp_enqueue_scripts', [ $this, 'scripts' ] );
add_action( 'enqueue_block_editor_assets', [ $this, 'enqueue_block_editor_scripts' ] );
add_action( 'wp_enqueue_scripts', [ $this, 'styles' ] );
Expand Down
6 changes: 5 additions & 1 deletion themes/10up-theme/src/Blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace TenUpTheme;

use TenupFramework\Assets\GetAssetInfo;
use TenupFramework\Module;
use TenupFramework\ModuleInterface;
use TenUpTheme\Traits\GetAssetInfo;

/**
* Blocks module.
Expand All @@ -36,6 +36,10 @@ public function can_register() {
* @return void
*/
public function register() {
$this->setup_asset_vars(
dist_path: TENUP_THEME_DIST_PATH,
fallback_version: TENUP_THEME_VERSION
);
add_action( 'enqueue_block_editor_assets', [ $this, 'blocks_editor_styles' ] );
add_action( 'init', [ $this, 'enqueue_block_specific_styles' ] );
add_action( 'init', [ $this, 'register_theme_blocks' ] );
Expand Down
43 changes: 0 additions & 43 deletions themes/10up-theme/src/Traits/GetAssetInfo.php

This file was deleted.

Loading