https://github.com/fkhadra/style2js
https://github.com/fkhadra/style2js
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/fkhadra/style2js
- Owner: fkhadra
- License: mit
- Created: 2020-12-27T20:19:52.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-01-16T17:50:25.000Z (almost 2 years ago)
- Last Synced: 2025-03-22T06:16:28.549Z (10 months ago)
- Language: TypeScript
- Size: 443 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Style2js
Generate helpers to inject your css into the dom when no css loader is available.
For example the command below will output 3 files into your dist folder
```sh
style2js style.min.css --out-dir ./dist
|_ inject-style.js
|_ inject-style.esm.js
|_ inject-style.d.ts
```
When someone use your library, he can do the following to load the css
```js
import { injectStyle } from "your-library/inject-style";
// inject the stylesheet into the dom
injectStyle();
```
## Installation
You can install the package with npm or yarn
```sh
npm i style2js
// with yarn
yarn add style2js
```
Or use it directly via npx
```sh
npx style2js
```