[wp-trac] [WordPress Trac] #38672: Custom CSS should work with existing Jetpack custom CSS

WordPress Trac noreply at wordpress.org
Fri Nov 11 09:33:05 UTC 2016


#38672: Custom CSS should work with existing Jetpack custom CSS
-----------------------------+------------------------------
 Reporter:  helen            |       Owner:  georgestephanis
     Type:  defect (bug)     |      Status:  reviewing
 Priority:  highest omg bbq  |   Milestone:  4.7
Component:  Customize        |     Version:
 Severity:  blocker          |  Resolution:
 Keywords:  has-patch        |     Focuses:
-----------------------------+------------------------------

Comment (by westonruter):

 @georgestephanis ok, I've taken a stab at putting together a standalone
 SCSS extension to Custom CSS, working out the shortcomings in core that
 need to be patched (see [attachment:38672.extensibility.diff]). With that
 patch applied, take a look at this [https://github.com/xwp/wp-custom-scss-
 demo Custom SCSS Demo] plugin and the approach it takes to extend.

 Two key things are adding a subclass of `WP_Customize_Custom_CSS_Setting`
 to handle the special logic for fetching the SCSS value and updating it
 into the `post_content_filtered`. And also the logic for doing selective
 refresh when SCSS is selected as the preprocessor.

 Changes included in [attachment:38672.extensibility.diff]:

 * Eliminate `final`-ity from `WP_Customize_Custom_CSS_Setting` class to
 allow extensibility.
 * Eliminate use of `wp_get_custom_css()` when getting the setting value.
 Use the underlying `post_value` directly when `is_previewed`.
 * Make clear that `wp_get_custom_css()` is specifically for obtaining the
 value to render/display.
 * Move anonymous functions handing JS previewing for `custom_logo`,
 `custom_css`, and `background` into named functions on the
 `wp.customize.settingPreviewHandlers` to allow plugins to override/extend.
 * Update `_custom_background_cb` to always print a `style` tag in the
 customizer preview.
 * Update `background` preview logic to replace existing `style` element
 instead of appending a new `style` to the `head`, and thus unexpectedly
 overriding any Custom CSS in the preview.

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


More information about the wp-trac mailing list