[wp-trac] [WordPress Trac] #43055: Reorganize Core JS / introduce build step
WordPress Trac
noreply at wordpress.org
Tue Jan 9 15:35:01 UTC 2018
#43055: Reorganize Core JS / introduce build step
--------------------------+------------------------------
Reporter: omarreiss | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Resolution:
Keywords: dev-feedback | Focuses: javascript
--------------------------+------------------------------
Comment (by omarreiss):
To share a little more context. Here's an overview of the directory
structure I've devised and the idea behind it.
{{{
src/js | All the JavaScript source.
├── _enqueues | Any script that ends up being enqueued.
│ ├── admin | Procedural scripts ran in the admin.
│ ├── deprecated | All deprecated scripts.
│ ├── lib | All standalone lib scripts.
│ ├── vendor | All 3rd party deps that can't be managed
with NPM.
│ └── wp | All scripts that assign something to the
wp namespace.
│ ├── customize | Anything under wp.customize.
│ ├── editor | Anything under wp.editor.
│ ├── media | Anything under wp.media.
│ ├── utils | Anything under wp.utils.
│ └── widgets | jQuery widgets on the wp namespace.
└── media | The media library.
}}}
As I see it, most of the future source will live outside of the
`_enqueues` directory. One of the things this would enable us to do is to
extract all of the business logic from the customizer into a modular
library. This is something that can be done very easily in this structure
and will make it much easier for us to get started once we move to the
customizer / Gutenberg focus. The only thing that would remain in the
`_enqueues` would be things like global assignments. An alternative
approach is to not have these at all anymore and just configure Webpack to
do that, but that is something we can also decide in a later stage. The
important thing is that this structure makes it possible.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43055#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list