You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[Loading the Compiled CSS as an External Stylesheet](#loading-the-compiled-css-as-an-external-stylesheet)
25
26
*[Setting the Value Callback](#setting-the-value-callback)
26
27
27
28
## Overview
@@ -134,6 +135,18 @@ This will print the contents of `dynamic-style.css` into the document `<head>` s
134
135
135
136
If multiple calls to `wp_dynamic_css_enqueue()` are made with different CSS files, then their contents will be appended to the same `<style>` section in the document `<head>`.
136
137
138
+
### Loading the Compiled CSS as an External Stylesheet
139
+
140
+
Instead of printing the compiled CSS to the head of the document, you can alternatively load it as an external stylesheet by setting the second parameter to `false`:
This will reduce the loading time of your document since the call to the compiler will be made asynchronously as an http request. Additionally, styelsheets that are loaded externally can be cached by the browser, as opposed to stylesheets that are printed to the head.
147
+
148
+
The disadvantage of this approach is that the Customizer's live preview will not show the changes take effect without manually reloading the page.
149
+
137
150
## Setting the Value Callback
138
151
139
152
The example given in the overview section uses the `get_theme_mod()` function to retrieve the value of the variables:
@@ -183,6 +196,6 @@ body {
183
196
184
197
## TODO
185
198
199
+
*~~Add support for loading the compiled CSS externally instead of printing to the document head~~ (Added in 1.0.1)
186
200
* Add support for multiple value callback functions
187
-
* Add support for loading the compiled CSS externally instead of printing to the document head
0 commit comments