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

More reader friendly functions.php #1260

Closed
bahiirwa opened this issue Feb 15, 2018 · 1 comment
Closed

More reader friendly functions.php #1260

bahiirwa opened this issue Feb 15, 2018 · 1 comment

Comments

@bahiirwa
Copy link
Contributor

I am hoping to add some readability to the functions.php file by splitting the file into two files.

  1. enqueue.php
  2. theme-setup.php

Why?
I saw a pattern of thought similar to what I go through developing with _s as I was reading WordPress/gutenberg-starter-theme#36.

As a starter theme, I understand _s shouldn't be complex. However, while developing the functions.php file keeps growing in lines as you make more conditions for enqueuing style and scripts to particular page templates for example. With the issue above and gutenberg coming shortly, I see that the need to enqueue style and scripts for WP blocks while the functions.php becomes a little unreadable - my thought again. However, if we split the file according to functionality as the other file splits in the inc folder, we can achieve some consistency and more readability.

I hope this is helpful for many. Please share your thoughts. If its a green light can whip up a PR for that.

@laurelfulford
Copy link
Contributor

Hi @bahiirwa! Thank you for submitting this issue, and explaining the reasoning behind it.

I can see how this could help with more complicated themes that have a lot of enqueues. But _s itself is pretty basic, and this could be overkill for the simpler themes people build with it.

Right now, I think this is something that should be done on a theme-by-theme basis, when a theme’s complexity calls for it. But it's something we could revisit with _s if it does become more complex in the future!

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

No branches or pull requests

3 participants