Skip to content

Commit e146a83

Browse files
author
Yoav Kadosh
committed
Update README.md
1 parent 92b23ae commit e146a83

File tree

1 file changed

+37
-5
lines changed

1 file changed

+37
-5
lines changed

README.md

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,46 @@ A library for generating static stylesheets from dynamic content, to be used in
1616
* [Overview](#overview)
1717
* [Installation](#installation)
1818
* [Via Composer](#via-composer)
19-
* [Via WordPress.org](#via-wordpress)
20-
* [Manual install](#manual-install)
21-
* [Dynamic CSS Syntax](#dcss-syntax)
22-
* [Enqueueing Dynamic Stylesheets](#dcss-enqueue)
23-
* [Setting the Value Callback](#dcss-callback)
19+
* [Via WordPress.org](#via-wordpressorg)
20+
* [Manually](#manually)
21+
* [Dynamic CSS Syntax](#dynamic-css-syntax)
22+
* [Enqueueing Dynamic Stylesheets](#enqueueing-dynamic-stylesheets)
23+
* [Setting the Value Callback](#setting-the-value-callback)
2424

2525
## Overview
2626

27+
**WordPress Dynamic CSS** is a lightweight library for generating CSS stylesheets from dynamic content (i.e. content that can be modified by the user). The most obvious use case for this library is for creating stylesheets based on Customizer options. Using the special dynamic CSS syntax you can write CSS rules with variables instead of static values.
28+
29+
## Basic Example
30+
31+
**`functions.php`**
32+
33+
```php
34+
// 1. Load the library
35+
require_once 'wp-dynamic-css/bootstrap.php';
36+
37+
// 2. Set the callback function (used to convert variables to actual values)
38+
function my_dynamic_css_callback( $var_name )
39+
{
40+
return get_theme_mod($var_name);
41+
}
42+
wp_dynamic_css_set_callback( 'my_dynamic_css_callback' );
43+
44+
// 3. Enqueue the stylesheet
45+
wp_dynamic_css_enqueue( 'my-style.css' );
46+
```
47+
48+
**`my-style.css`**
49+
50+
```css
51+
body {
52+
background-color: $body_bg_color;
53+
}
54+
```
55+
56+
57+
In the above example...
58+
2759
## Installation
2860

2961
### Via Composer

0 commit comments

Comments
 (0)