intraxia / jaxion

A WordPress plugin framework for modern WordPress development.
http://intraxia.github.io/jaxion/
MIT License
15 stars 3 forks source link

Evaluate behavior of Assets\Register #20

Open mAAdhaTTah opened 6 years ago

mAAdhaTTah commented 6 years ago

See https://github.com/PressForward/pressforward/pull/991

mAAdhaTTah commented 6 years ago

Here are the options for Assets\Register:

  1. Rely 100% on SCRIPT_DEBUG and remove the set_debug method. This takes control away from the developer completely as to whether minified or unminified scripts get served, but it does match WordPress' behavior and is considered best practice. I would not be opposed to imposing this opinion on framework consumers, but note that it does mean that developers would be required to provide both minified and unminified scripts, or at least .js and .min.js versions of all their assets, as they can no longer know in advance which scripts will be required.

  2. Rely 100% on set_debug, allowing the developer to determine for themselves whether and how the assets are put into debug mode. While I use SCRIPT_DEBUG myself in conjunction with set_debug, others may prefer to do it with WP_DEBUG, their own constant (e.g. PF_DEBUG), or even a database option. Using set_debug allows them this control. We also have some additional options for this:

    1. set_debug defaults to true, which means developers are not required to ship minified scripts and can use .js by default.
    2. (This is the current behavior) set_debug defaults to false, which means developers are required to ship minified scripts.

Feasibly, I've also considered setting "debug mode" at the application level, but that might be too coarse of an API for this use case.

mAAdhaTTah commented 6 years ago

@AramZS Thoughts?