blob: 3a60828cc311a6dc94dd77ad3c5e747ad0dcbe43 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
<?php
namespace Dweipert\WpEnqueueAssets;
trait PluginUsesWordPressScripts
{
use UsesWordPressScripts;
/**
* Assuming the main plugin class file is in a sub-folder
*
* @var string
*/
protected string $pluginDir = __DIR__;
/**
* @param string $asset
*
* @return string
*/
public function assetsUrl(string $asset): string
{
return plugin_dir_url($this->pluginDir) . "{$this->buildDir}/$asset";
}
/**
* @param string $asset
*
* @return array
*/
public function assetsMeta(string $asset): array
{
return include plugin_dir_path($this->pluginDir) . "{$this->buildDir}/$asset.asset.php";
}
}
|