Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uppercod/stylis-pack
https://github.com/uppercod/stylis-pack
Last synced: about 3 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/uppercod/stylis-pack
- Owner: UpperCod
- Created: 2020-08-04T15:12:25.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-30T05:45:36.000Z (about 4 years ago)
- Last Synced: 2024-10-11T18:38:02.399Z (25 days ago)
- Language: JavaScript
- Size: 31.3 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# stylis-pack
[Stylis](https://github.com/thysultan/stylis.js) is fast to preprocess CSS fragments, nested, associate prefix and minimize code. Stylis-pack simply adds a layer for managing asynchronous plugins before serialization to include module import support, asynchronous parsing in parallel, and utilities for CSS management, achieving a PostCss-like effect.
## Submodules
1. [stylis-pack/utils](./src/utils)
2. [stylis-pack/plugin-import](./src/plugins/plugin-import)## Install
```bash
npm install stylis stylis-pack
```## Usage
```js
import { serialize, stringify } from "stylis";
import path from "path";
import { readFile } from "fs/promises";
import { load } from "stylis-pack/load";
import { pluginImport } from "stylis-pack/plugin-import";async function readCss(file) {
const { css } = await load(
{
file,
code: await readFile(file, "utf-8"),
},
[pluginImport({})]
);
return serialize(css, stringify);
}readCss(path.join(process.cwd(), "./test/style.css")).then(console.log);
```