Skip to content

Consider disabling script/style concatenation #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dd32 opened this issue Oct 14, 2022 · 2 comments · Fixed by #43
Closed

Consider disabling script/style concatenation #39

dd32 opened this issue Oct 14, 2022 · 2 comments · Fixed by #43

Comments

@dd32
Copy link
Member

dd32 commented Oct 14, 2022

Occasionally in Safari I get a unstyled admin page, seemingly because the wp-admin/load-styles.php call failed or timed out.

If static files are simpler for it to serve, it would be beneficial to remove the concatenation, as it serves no purpose other than to reduce network round time trips and most admin pages will have a different set of styles/scripts causing the browser caches to be ignored.

This can be done by using the following, which disables concatenation and gzip'ing of static resources.

define( 'CONCATENATE_SCRIPTS', false );
@adamziel
Copy link
Collaborator

https://github.com/WordPress/WordPress/blob/master/wp-includes/script-loader.php is full of other interesting constants to explore.

@adamziel
Copy link
Collaborator

adamziel commented Oct 14, 2022

I think that's a great idea @dd32! Here's what needed to make it a reality:

  • Define a constants, e.g. in _runWordPressCode
  • Remove the static assets from the WordPress .data bundle in prepare-wordpress.sh. There is even some prior art under the $LAZY_FILES if statement. Lazy files aren't that useful and could be removed as a concept, and the code inside that if could be repurposed.
  • Rebuild the WordPress bundle with npm run build:wp and test if it worked with npm run dev

Would you like to give it a try?

adamziel added a commit that referenced this issue Oct 14, 2022
Define 'CONCATENATE_SCRIPTS' as false in `wp-config.php` and removes most static assets from the `wp.data` build script. This makes for an incredible size decrease from 44M to 13M. See #39 and #2 for more details.

Co-authored-by: Adam Zieliński <[email protected]>
adamziel pushed a commit that referenced this issue May 30, 2025
…tory into Playground (#39)

## Motivation for the change, related issues

This PR adds support for automatically mounting project folders using
the Playground CLI.
If the user specifies the `--autoMount` argument, Playground CLI will
detect the project type and mount it into Playground.

The project folder can be a plugin, a theme, a WP-content folder, a
WordPress folder, a PHP folder, or a static HTML folder.

By automatically mounting, users don't need to write long mount commands
and the CLI ensures the mounted project folder won't be modified by
Playground.

## Implementation details

If the `--autoMount` argument is provided, the CLI will detect the
current mode and mount the current working directory.

Based on the mount type, the CLI adds necessary mounts and Blueprint
steps to `runCli` arguments.
User-provided arguments, won't be removed, the CLI only appends
arguments.

## Testing Instructions (or ideally a Blueprint)

- CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants