-
Notifications
You must be signed in to change notification settings - Fork 7
Only load block assets on frontend when block exists. #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
dkotter
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple typos that were preventing this from working properly on the front-end.
Once addressed, this does work and may be good enough. I am curious though, looking at the original issue, why this ends up loading the block editor script at all on the front-end? Seems like there may be a bigger issue here with how this block is built/registered that may be worth changing to fix the problem here
Co-authored-by: Darin Kotter <[email protected]>
Co-authored-by: Darin Kotter <[email protected]>
@fabiankaegy any insights from your perspective on this? |
Yeah ideally we should enqueue the assets via the |
…rontend script loading.
|
@jeffpaul / @dkotter / @fabiankaegy Sorry it's taken so long for me to make the requested changes here. I've refactored this to use the viewScript; tested and working locally. I chose to leave the frontend.js file in case it's needed, let me know if you'd like this removed. Please could you review the updates here? |
Description of the Change
Adds conditional check that the block (Tabs / Tab Items) exist on the post before enqueueing assets.
Closes #199
How to test the Change
/dist/blocks/tabs-item-block.jsand/dist/blocks/tabs-block.cssare not enqueuedChangelog Entry
Credits
Props @jamesmorrison
Checklist: