Skip to content

Commit

Permalink
feat: Implemented Loader Trait
Browse files Browse the repository at this point in the history
  • Loading branch information
seebeen committed Aug 10, 2023
1 parent 43f6b7b commit 896ab0e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 30 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"Extremis\\": "src"
},
"files": [
"/src/Utils/extremis-helpers.php"
"src/Utils/extremis-helpers.php"
]
},
"require": {
Expand Down
18 changes: 10 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 3 additions & 21 deletions src/Extremis.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
namespace Extremis;

use Oblak\WP\Asset_Loader;
use Oblak\WP\Loader_Trait;

/**
* Main child theme class
*/
class Extremis {
use Loader_Trait;

/**
* Theme modules
Expand Down Expand Up @@ -86,7 +88,7 @@ public function load_textdomain() {
* Initializes the asset loader.
*/
public function init_asset_loader() {
! empty( $this->assets ) && Asset_Loader::get_instance()->register_namespace( 'extremis', $this->assets );
! empty( $this->assets ) && Asset_Loader::get_instance()->register_namespace( $this->namespace, $this->assets );
}

/**
Expand Down Expand Up @@ -131,26 +133,6 @@ public function modify_body_class( array $classes ): array {
return array_filter( $classes );
}

/**
* Get the cache buster asset path
*
* @param string $asset Asset path.
* @return string Asset path with cache buster.
*/
public function asset_path( string $asset ): string {
return Asset_Loader::get_instance()->get_path( 'extremis', $asset );
}

/**
* Get the cache buster asset uri
*
* @param string $asset Asset uri.
* @return string Asset uri with cache buster.
*/
public function asset_uri( string $asset ): string {
return Asset_Loader::get_instance()->get_uri( 'extremis', $asset );
}

/**
* Get the module class
*
Expand Down

0 comments on commit 896ab0e

Please sign in to comment.