[wp-trac] [WordPress Trac] #64369: Disable sourceURL Comments

WordPress Trac noreply at wordpress.org
Sat Dec 6 00:20:02 UTC 2025


#64369: Disable sourceURL Comments
---------------------------+------------------------------
 Reporter:  anton7249      |       Owner:  (none)
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Script Loader  |     Version:  6.9
 Severity:  normal         |  Resolution:
 Keywords:  2nd-opinion    |     Focuses:  javascript, css
---------------------------+------------------------------
Changes (by westonruter):

 * keywords:   => 2nd-opinion
 * focuses:   => javascript, css
 * component:  General => Script Loader
 * version:   => 6.9


Comment:

 This was introduced in #63887 and related tickets.

 I don't feel too strongly that the `sourceURL` comments always be visible,
 but I'm also not sure that `SCRIPT_DEBUG` is the right way to exclusively
 enable them. For example, when `SCRIPT_DEBUG` is off, styles are minified
 and it is useful to be able to see the source for where minified scripts
 and styles are coming from as well. It's also useful for running a code
 coverage report with minified sources. It's also useful to easily identify
 the source of a JS error in production without enabling `SCRIPT_DEBUG`.

 Maybe there should be a function like
 `wp_should_show_source_url_comments()` with a corresponding filter that
 defaults to the value of `SCRIPT_DEBUG`. This would allow an opt-in to
 `sourceURL` without also serving unminifed scripts and styles.

 This applies scripts as well as to styles.

 cc @jonsurrell

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64369#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list