humanmade / humanmade/asset-loader

Cannot enqueue CSS and JS asset with the same handle

Open
#30 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
26
Forks
2
PR merge metrics
No merged PRs in 30d

Description

In the WordPress world it's possible for a CSS dependency and a JS dependency to share the same handle. When using Asset Loader, this works fine for a production build but not when using webpack-dev-server during dev.

It appears that the latterly registered dependency gets skipped completely. In the example below, the `main.js` file gets enqueued but the `style.css` file does not.

```php
\Asset_Loader\enqueue_asset(
plugin_dir_path( __DIR__ ) . 'build/asset-manifest.json',
'main.js',
[
'handle' => 'hello-world',
]
);
\Asset_Loader\enqueue_asset(
plugin_dir_path( __DIR__ ) . 'build/asset-manifest.json',
'style.css',
[
'handle' => 'hello-world',
]
);
```

May be related to #27

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.