Skip to content
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

Loading front-end assets #6450

Closed
mrleemon opened this issue Apr 26, 2018 · 2 comments
Closed

Loading front-end assets #6450

mrleemon opened this issue Apr 26, 2018 · 2 comments
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience [Type] Help Request Help with setup, implementation, or "How do I?" questions.

Comments

@mrleemon
Copy link
Contributor

mrleemon commented Apr 26, 2018

Issue Overview

Just a small question. The register_block_type() function accepts an array of different arguments. One can use the editor_script and editor_style arguments to load assets just in the editor and the script and style arguments to load them in both the editor and the front-end. My question is: is there a way to load assets JUST in the front-end?

Thanks in advance

@mrleemon
Copy link
Contributor Author

mrleemon commented Apr 26, 2018

I resorted to enclose the frontend and editor wp_register_style() and wp_register_script() calls inside of a !is_admin() conditional statement. I don't know if there's a better way to do this, but this works for me.

@danielbachhuber danielbachhuber added [Feature] Extensibility The ability to extend blocks or the editing experience [Type] Help Request Help with setup, implementation, or "How do I?" questions. labels Apr 26, 2018
@gziolo
Copy link
Member

gziolo commented May 14, 2018

It seems like a way to go until we introduce a comprehensive solution for the front-end assets. There have been some explorations for a related issue #5445 which should be continued after Gutenberg lands in WordPress core. There are some open PRs which are still in progress like #6166 or #6200. @kanishkdudeja can provide you more details.

@gziolo gziolo closed this as completed May 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience [Type] Help Request Help with setup, implementation, or "How do I?" questions.
Projects
None yet
Development

No branches or pull requests

3 participants