Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#38375 closed defect (bug) (fixed)

Twenty Seventeen: Flatten/rename directory structure

Reported by: dd32's profile dd32 Owned by: karmatosed's profile 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)

38375.diff (33.0 KB) - added by bronsonquick 8 years ago.
38375.1.diff (13.3 KB) - added by bronsonquick 8 years ago.
38375.2.diff (13.3 KB) - added by bronsonquick 8 years ago.
Take #3

Download all attachments as: .zip

Change History (18)

#1 @mor10
8 years ago

I tend to agree. The current structure is a bit fractured.

#2 @bronsonquick
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 @karmatosed
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.

Last edited 8 years ago by karmatosed (previous) (diff)

#4 @celloexpressions
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 @davidakennedy
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 @davidakennedy
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/

@bronsonquick
8 years ago

#8 @bronsonquick
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.

#9 @bronsonquick
8 years ago

  • Keywords has-patch added; needs-patch removed

#10 @tareiking
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 @bronsonquick
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!

@bronsonquick
8 years ago

@bronsonquick
8 years ago

Take #3

#12 @karmatosed
8 years ago

  • Owner set to karmatosed
  • Resolution set to fixed
  • Status changed from new to closed

In 38873:

Twenty Seventeen: Renaming of directory structure

This changes components directory to be called template-parts. Changes reflected in all files that call those sections.

Props bronsonquick, dd32

Fixes #38375

#13 @karmatosed
8 years ago

In 38875:

Twenty Seventeen: Renaming of directory structure

This changes components directory to be called template-parts. Changes reflected in all files that call those sections.

Props bronsonquick, dd32

Fixes #38375

#14 @netweb
8 years ago

For reference, [38874] was not linked to this ticket and reverted [38873] per the Slack discussion in that "Patches don't work for file moves, needs to be done by the committer." . This was resolved in the follow up [38875] commit.

#15 @SergeyBiryukov
8 years ago

  • Summary changed from Flatten/rename TwentySeventeen directory structure to Twenty Seventeen: Flatten/rename directory structure
Note: See TracTickets for help on using tickets.