Skip to content

Commit 5087653

Browse files
docs(README.md): typescript and modifyCSSRule
1 parent f17f592 commit 5087653

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

README.md

+16-9
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@
4141
<h3 align="center">Change CSS</h3>
4242

4343
<p align="center">
44-
A library to help modify css in all it's forms easily.
44+
A library to help find, modify and work with css rules easily.
4545
<br />
4646
<a href="https://github.com/suryarajendhran/change-css"><strong>Explore the docs »</strong></a>
4747
<br />
4848
<br />
49-
<a href="https://github.com/suryarajendhran/change-css">View Demo</a>
49+
<!-- <a href="https://github.com/suryarajendhran/change-css">View Demo</a> -->
5050
·
5151
<a href="https://github.com/suryarajendhran/change-css/issues">Report Bug</a>
5252
·
@@ -57,8 +57,8 @@
5757

5858

5959
<!-- TABLE OF CONTENTS -->
60-
<details open="open">
61-
<summary><h2 style="display: inline-block">Table of Contents</h2></summary>
60+
<details>
61+
<summary>Table of Contents</summary>
6262
<ol>
6363
<li>
6464
<a href="#about-the-project">About The Project</a>
@@ -87,7 +87,7 @@
8787
<!-- ABOUT THE PROJECT -->
8888
## About The Project
8989

90-
To be added soon.
90+
Sometimes, swapping out classes is not enough so you can instead modify the stylesheets themselves. change-css is a library that can help you do just that. This can be a very easy path to theming a dynamic site, especially if the theme variables are generated through JS.
9191
<!-- [![Product Name Screen Shot][product-screenshot]](https://example.com)
9292
9393
Here's a blank template to get started:
@@ -122,9 +122,9 @@ You need to have node and NPM installed
122122
```sh
123123
npm install --save change-css
124124
```
125-
2. Import into your file
125+
2. Import necessary functions into your file
126126
```js
127-
const getCSSRule = require('change-css'); // This is the only function that is available at the moment
127+
import { getCSSRule, modifyCSSRule } from 'change-css';
128128
```
129129

130130

@@ -133,15 +133,22 @@ You need to have node and NPM installed
133133
## Usage
134134

135135
### Get a CSS Rule
136-
Use the getCSSRule to search your document's stylesheets for a [CSS Rule](https://developer.mozilla.org/en-US/docs/Web/API/CSSRule).
136+
Use getCSSRule() to search your document's stylesheets for a [CSS Rule](https://developer.mozilla.org/en-US/docs/Web/API/CSSRule).
137137
```js
138-
const getCSSRule = require('change-css');
138+
import { getCSSRule } from 'change-css';
139139
const CSSRule = getCSSRule('.text-base');
140140
// Returns a CSSRule if such a rule exists
141141
// in any of the stylesheets in your document
142142
// else returns false.
143143
```
144144

145+
### Modify a CSS Rule
146+
The modifyCSSRule() function makes it easier to modify a [CSS Rule](https://developer.mozilla.org/en-US/docs/Web/API/CSSRule) with a single function call.
147+
```js
148+
import { modifyCSSRule } from 'change-css';
149+
modifyCSSRule('body', { fontFamily: 'Inter' });
150+
```
151+
145152
<!-- _For more examples, please refer to the [Documentation](https://example.com)_ -->
146153

147154

0 commit comments

Comments
 (0)