Skip to content

Conversation

@pbearne
Copy link
Contributor

@pbearne pbearne commented Jan 12, 2026

What?

Closes #174

tide up the enqueue_style() code

Why?

tide up and fix warning

Open WordPress Playground Preview

@github-actions
Copy link

github-actions bot commented Jan 12, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @pbearne@git.wordpress.org.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: pbearne@git.wordpress.org.

Co-authored-by: dkotter <dkotter@git.wordpress.org>
Co-authored-by: pbearne <pbearne@git.wordpress.org>
Co-authored-by: juanfra <juanfra@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov
Copy link

codecov bot commented Jan 12, 2026

Codecov Report

❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.87%. Comparing base (128aebe) to head (a5979d6).
⚠️ Report is 63 commits behind head on develop.

Files with missing lines Patch % Lines
includes/Asset_Loader.php 0.00% 9 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #175      +/-   ##
=============================================
+ Coverage      46.89%   47.87%   +0.97%     
- Complexity       208      246      +38     
=============================================
  Files             19       22       +3     
  Lines           1271     1433     +162     
=============================================
+ Hits             596      686      +90     
- Misses           675      747      +72     
Flag Coverage Δ
unit 47.87% <0.00%> (+0.97%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jeffpaul jeffpaul requested a review from dkotter January 13, 2026 00:09
@jeffpaul jeffpaul added this to the 0.2.0 milestone Jan 13, 2026
Copy link
Collaborator

@dkotter dkotter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple things here:

  1. There's a handful of PHPCS things that need cleaned up
  2. I'd argue the better approach here is an early check to see if the file exists. If not, there's no reason to run any of the code. I think that fixes the issue you're seeing and removes the need for most of the change here

@jeffpaul jeffpaul modified the milestones: 0.2.0, 0.3.0 Jan 13, 2026
@pbearne
Copy link
Contributor Author

pbearne commented Jan 13, 2026

2. I'd argue the better approach here is an early check to see if the file exists. If not, there's no reason to run any of the code. I think that fixes the issue you're seeing and removes the need for most of the change here

I thought about that, but the function can use an asset.php file

@dkotter
Copy link
Collaborator

dkotter commented Jan 13, 2026

  1. I'd argue the better approach here is an early check to see if the file exists. If not, there's no reason to run any of the code. I think that fixes the issue you're seeing and removes the need for most of the change here

I thought about that, but the function can use an asset.php file

Not sure I follow? It does pull the asset.php file from the same location as the asset itself and then it uses that for the dependency array and version. But the main point of these methods is to run wp_enqueue_script|style and if the file we're trying to enqueue doesn't actually exist, seems we'd be better of returning early before any processing

@juanfra
Copy link
Member

juanfra commented Jan 16, 2026

Thanks for the PR! In addition to the previous review, I believe we should also have the check and early bail for enqueue_script().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

if the file for an asset is missing we get warning from filemtime()

4 participants