So no where can I find where the ...asset.php that are generated, and then used for Stylesheet dependencies, are actually appropriate. The dependencies arrays are generally always empty and actually seem to be generated only based on JavaScript import/use dependencies. The @wordpress/dependency-extraction-webpack-plugin is actually not designed for stylesheets and is designed for JavaScript files.
The main problem is that in so many examples stylesheets are setup like:
function themeslug_assets() {
$asset = include get_theme_file_path( 'public/css/screen.asset.php' );
wp_enqueue_style(
'themeslug-style',
get_theme_file_uri( 'public/css/screen.css' ),
$asset['dependencies'],
$asset['version']
);
}
The problem here is that that $asset array values are not populated properly and we need to actually manage those manually.
@timnolte in your example $asset['dependencies'] still doesn't work. We need it to work for dataviews and any React App in the admin area. In my links the authors use workarounds.
So no where can I find where the
...asset.php
that are generated, and then used for Stylesheet dependencies, are actually appropriate. Thedependencies
arrays are generally always empty and actually seem to be generated only based on JavaScript import/use dependencies. The @wordpress/dependency-extraction-webpack-plugin is actually not designed for stylesheets and is designed for JavaScript files.The main problem is that in so many examples stylesheets are setup like:
The problem here is that that
$asset
array values are not populated properly and we need to actually manage those manually.