#38375 closed defect (bug) (fixed)
Twenty Seventeen: Flatten/rename directory structure
Reported by: | dd32 | Owned by: | karmatosed |
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Bundled Theme | Keywords: | needs-testing has-patch |
Focuses: | Cc: |
Description
With TwentySeventeen merged in [38833] it's a little more obvious about the directory structure than presented on Github.
Burying css/
, images/
, and js/
within an assets/
folder isn't particularly useful and isn't immediately obvious as to the contents IMHO, promoting these to a root level entry can't hurt.
Likewise as @bronsonquick mentioned to me, having template parts (used with get_template_part()
) within a components/
folder (where no SCSS/JS/etc exists as 'components') feels weird and confusing to me as a 'newbie theme developer'.
My immediate thought is that /components/*/*.php
would feel better as template-parts/*.php
.
I don't feel super strongly on these, but it might make it a little more accessible to those who have not worked on complex themes structured in this format.
Attachments (3)
Change History (18)
#2
@
8 years ago
For the record I have no problem with the assets/
folder. That's almost a "best practice" these days.
I'm totes down for template-parts/*.php
though as it'll match up with Twenty Sixteen and remain consistent for folks who are new to WordPress and trying to understand how themes work.
#3
@
8 years ago
I would +1 for assets/ staying that is a very good distinction for the contents.
More fractured development can in some cases make sense. I quantify this as being very keen on this method and seeing it useful for users. However, I am involved in the project this comes from: http://components.underscores.me/ - I'm potentially bringing that bias but it's something I've seen.
I actually agree with components/ as the concept isn't language dependent. In saying that I am not at all against it being changed if this is popular as a decision and makes sense for this theme. I don't however think it is an issue for users or theme creators.
#4
@
8 years ago
I agree with both suggestions, as template-parts
has been the convention for some time. components
does not imply that the contents are actually partial templates, but suggests something more like assets
to me at a first glance.
#5
@
8 years ago
I'm for assets
staying as is because that's a fairly common convention in the front end development world. You'll find it a lot in themes on WordPress.org.
As for using components
for the templates parts, I'd agree that template-parts
makes more sense in a WordPress context. And if a lot of people agree with that, we can change it – especially if it helps new themers and users understand everything better.
I like components
. I'm biased, as I've worked on the Components project @karmatosed mentioned as well.
That said, think of the future. Where more JavaScript exists in a theme than pure WordPress PHP. The term template-parts
, while generic, is very much WordPress terminology too. And using a different term here could begin to, in a subtle way, get people used to a future where theming looks a lot different.
This ticket was mentioned in Slack in #core-themes by davidakennedy. View the logs.
8 years ago
#7
@
8 years ago
- Keywords needs-patch added; 2nd-opinion removed
On this ticket, the group decided to keep assets
as it is, but change components
to template-parts
. See:
https://make.wordpress.org/core/2016/10/21/twenty-seventeen-meeting-notes-oct-21-2016/
#8
@
8 years ago
- Keywords needs-testing added
Seeing I was chatting to @dd32 about this I figured it was about time I contributed to core again with a patch!
I used Git and did a git diff
and piped that out to a file. I tested it with grunt patch
and it looks good to me.
#10
@
8 years ago
I am personally a fan of template-parts
naming vs. components
in default WordPress themes as it's more WordPressy (seconding @davidakennedy's view here).
The usage of an assets
folder makes the root directory a little less intimidating to view for newbie theme developers
and as has been mentioned already, its fairly standard practice now.
#11
@
8 years ago
Drat! Apparently git diff
doesn't handle renamed folders in a way that's SVN friendly! I guess I'll try and remember how to use svn
again for this!
#12
@
8 years ago
- Owner set to karmatosed
- Resolution set to fixed
- Status changed from new to closed
In 38873:
I tend to agree. The current structure is a bit fractured.