-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
30 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,40 @@ | ||
<h1 align="center"> css-style-inject </h1> | ||
[![https://img.shields.io/npm/v/css-style-inject](https://img.shields.io/npm/v/css-style-inject)](https://www.npmjs.com/package/css-style-inject) | ||
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) | ||
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) | ||
[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=sebgroup/frontend-tools)](https://dependabot.com) | ||
![https://img.shields.io/npm/l/css-style-inject](https://img.shields.io/npm/l/css-style-inject) | ||
![npm bundle size](https://img.shields.io/bundlephobia/minzip/css-style-inject) | ||
|
||
<hr/> | ||
|
||
<p> | ||
This is a plugin to inject styles to document head dynamically and it checks injections by unique id to prevent style duplication. | ||
</p> | ||
# CSS Style Injector | ||
|
||
## Installation | ||
|
||
<h3> List of features </h3> | ||
### npm | ||
|
||
<ul> | ||
<li>To attach styles: <code>injectCSS('..css', 'uniqueId')</code></li> | ||
<li>To detach styles: <code>detachCSS('uniqueId')</code></li> | ||
</ul> | ||
```terminal | ||
npm i css-style-inject | ||
``` | ||
|
||
<h3> Download & Installation </h3> | ||
### yarn | ||
|
||
```shell | ||
$ npm i css-style-inject | ||
```terminal | ||
yarn add css-style-inject | ||
``` | ||
<h3>Contributing</h3> | ||
Keep it simple. Keep it minimal. | ||
|
||
<h3>Authors or Acknowledgments</h3> | ||
<ul> | ||
<li>Kher Phay Chang</li> | ||
</ul> | ||
<hr/> | ||
|
||
<h3>License</h3> | ||
## Usage | ||
Add this to your javascript/ typescript file | ||
|
||
This project is licensed under the ISC License | ||
### attach styles to head | ||
```typescript | ||
import { injectCSS } from "css-style-inject"; | ||
injectCSS('..css', 'uniqueId'); | ||
``` | ||
|
||
### detach styles from head | ||
```typescript | ||
import { detachCSS } from "css-style-inject"; | ||
detachCSS('uniqueId') | ||
``` |