-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Script debug when version controlled #12457
Conversation
function gutenberg_script_debug() { | ||
return ( | ||
( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) || | ||
file_exists( gutenberg_dir_path() . '.git' ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if, in the course of development, I do want to test with minified souces? Switching on the existence of .git
seems like a very inflexible method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same is true if we set it in the Docker config: you'd need to edit the config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An environment variable seems the best option here; why not have MINIFY_JS
, SCRIPT_DEBUG
, or something else, be an env var we could check for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @mcsf that checking on .git
is a bit too inflexible, but using an env var would work well here I think.
function gutenberg_script_debug() { | ||
return ( | ||
( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) || | ||
file_exists( gutenberg_dir_path() . '.git' ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An environment variable seems the best option here; why not have MINIFY_JS
, SCRIPT_DEBUG
, or something else, be an env var we could check for?
Is there any way to move it forward? This PR got out of date but it would be awesome to find a way to enable this flag through Docker. |
You can do it by adding these lines to docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run --rm $CLI config set WP_DEBUG true --raw --type=constant
docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run --rm $CLI config set SCRIPT_DEBUG true --raw --type=constant
docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run --rm $CLI config set WP_DEBUG_DISPLAY true --raw --type=constant Location in the file doesn't matter, they just need |
I opened #14371 where I want to provide an option to override site constants through env variables. |
Description
When I setup Gutenberg for local development, I'd expect it to load unminified files.
How has this been tested?
Screenshots
Types of changes
Checklist: