Make WordPress Core

Opened 12 months ago

Closed 12 months ago

Last modified 12 months ago

#24152 closed feature request (wontfix)

Use JSON as alternative to headers

Reported by: ryanve Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Themes Keywords: close
Focuses: Cc:


Themes are required to include style.css for its header info. Plugins are required to contain header info in their main file. It makes more sense to store package info in JSON. A filename like theme.json or plugin.json (or an all-encompassing wordpress.json) seems viable. When present, the JSON file would be favored over the headers. This would make it possible to have a theme without a style.css file.

Change History (12)

comment:1 ryanve12 months ago

  • Type changed from defect (bug) to feature request

comment:2 toscho12 months ago

  • Cc info@… added

Oh, yes please!

comment:3 TJNowell12 months ago

  • Cc tom@… added

comment:4 johnbillion12 months ago

  • Cc johnbillion added

comment:5 SergeyBiryukov12 months ago

  • Component changed from General to Themes

comment:6 nacin12 months ago

  • Keywords close added

While this means you don't need a style.css file for a theme, you'll still need a .json file. Considering you don't actually need to use style.css for, well, CSS, this isn't much of a benefit. If anything, it means people will need to look in two places, not one. And given that all plugins do need a file, this will mean that plugins now need a minimum of two files. (Many plugins are very simple single-file plugins that can go into wp-content/plugins directly, and this is common for custom managed sites.)

While JSON files are both machine-readable and human-readable, they aren't necessarily human-editable. You need to understand syntax and such, and there are some gotchas like trailing commas and when to quote that can be confusing. I think this would be a nice thing to keep in our back pocket in case the world of dependencies, testing, and such force something more powerful than the existing headers. But the current headers are a very integral part of WordPress and are one of those things that make things so simple to so many.

Cool idea, but suggesting we close this as maybelater.

comment:7 rmccue12 months ago

Oh please no. I love JSON as an interchange format between machines, but as configuration files, they're just insane. Agreed with nacin, +1 on close.

comment:8 markoheijnen12 months ago

+1 for close it too. For dependencies it can be a JSON file but then use a file only for that.

comment:9 nacin12 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

comment:10 travisnorthcutt12 months ago

this will mean that plugins now need a minimum of two files.

Not to nitpick (ok, to nitpick), doesn't the proposed functionality (When present, the JSON file would be favored over the headers.) suggest that a json file isn't strictly required, and the existing method of using headers would still work just fine?

comment:11 TJNowell12 months ago

Keeping in mind that themes already need 2 files as a minimum, index.php and style.css, and that the primary argument against this is a situation that we already have in plugins, namely that we have to define our plugin in the header, and readme.txt

comment:12 zamoose12 months ago

Extra nitpicking: if it's a child theme, you don't even need an index.php.

Note: See TracTickets for help on using tickets.