Skip to content
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

Feature Request: Support Script Debug #1456

Closed
1 task
BrookeDot opened this issue Oct 7, 2021 · 4 comments
Closed
1 task

Feature Request: Support Script Debug #1456

BrookeDot opened this issue Oct 7, 2021 · 4 comments

Comments

@BrookeDot
Copy link
Contributor

Problem Statement

There are times where it is beneficial to load unminified assets within a theme. In order to facilitate this, WordPress core uses the SCRIPT_DEBUG constant. More on that in the official documentation.

Since Understrap is already including the source files (at it should) this PR makes it possible to define SCRIPT_DEBUG to load the source files

Who will benefit?

Primarily developers working locally, or in other setups where they it is beneficial to not load the minified versions of scripts.

Benefits and risks

The benefit is that s brings Understrap more inline with best practices around provide the option to load full versions of assets. Of course the risk is if someone leaves the constant set on production it could have performance implications. But the risk is pretty small.

Proposed solution

If SCRIPT_DEBUG is defined as true, then load the full scripts in inc/enqueue.php. The alternative would be an Understrap unique constant or setting, but since this is a dev feature relying on core makes sense to me here.

Examples

Yes, this is common both WordPress Core and many other themes, frameworks, and plugins.

Priority/Severity

  • Low (anything else e.g., trivial, minor improvements)
@0dp
Copy link
Collaborator

0dp commented Oct 7, 2021

Yeah, this makes perfect sense to me. Good call!

@bacoords
Copy link
Member

bacoords commented Oct 7, 2021

I agree with this with one caveat: often (and more often since we've migrated away from gulp) the issue is with the minification itself, so the non-minified scripts work, but the minified scripts don't. So if you're not testing minified scripts on your local, you're not testing what'll eventually be deployed.

I still think we should do this, but something to keep in mind that this adds another thing for developers to keep an eye on.

@bacoords bacoords added this to the 1.1.0 milestone Oct 7, 2021
@pattonwebz
Copy link
Contributor

In my view debugging actual code issues - rather than build issues - is a lot easier with unminified files. +1 from me on this

@bacoords bacoords added this to TODO in Understrap RoadMap Oct 16, 2021
@bacoords bacoords moved this from TODO to DONE in Understrap RoadMap Nov 23, 2021
@bacoords
Copy link
Member

bacoords commented Dec 1, 2021

Closed with release 1.1.0.

@bacoords bacoords closed this as completed Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

4 participants