WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.48k stars 4.18k forks source link

Plugin: Include readable source files #23960

Open sirreal opened 4 years ago

sirreal commented 4 years ago

Is your feature request related to a problem? Please describe.

It's often helpful to include readable source files. There's a convention in WordPress to include minified and readable source files and to enqueue one or the other depending on the SCRIPT_DEBUG constant.

Gutenberg currently only includes minified JavaScript.

I propose the Gutenberg plugin follow the convention, including minified and readable JavaScript and enqueuing one or the other based on SCRIPT_DEBUG.

In this case readable source means unminified, bundled JavaScript packages. It does not mean all of the individual source files in the Gutenberg repository.

(See https://github.com/WordPress/gutenberg/pull/23926 for a related change to use the .min.js convention)

Note: the plugin guidelines allow minified files to be included as long as there is a link to sources in a public repository. I consider this proposal to be an ideal, above and beyond plugin requirements.

This was discussed in the #core-editor meeting.

sirreal commented 4 years ago

Note that https://github.com/WordPress/gutenberg/pull/23926 was reverted in #24239 due to https://github.com/WordPress/gutenberg/issues/24236 (missing translations).

This proposal would allow us to use .min.js for minified files (following convention) without causing the regression in https://github.com/WordPress/gutenberg/issues/24236. The translations were not parsed because the plugin repository ignores .min.js when extracting strings for translation.

simison commented 3 years ago

In addition to better developer experience, this impacts platform level minifiers as well: traditionally in WordPress, files without .min are considered non minified, and thus platform level minifier plugins process those files even if in Gutenberg they are already minified, which is a bit wasteful.

Related, Include Source Maps with Plugin: https://github.com/WordPress/gutenberg/issues/15732