@lincy/static-style-extract
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

Static-Style-Extract

Provide a lib like @ant-design/static-style-extract to support generate static css for SSR usage to generate raw css file for caching.

NPM version build status Test coverage Dependencies DevDependencies npm download bundle size dumi

Install

npm install @lincy/static-style-extract

Usage

import extractStyle from `@lincy/static-style-extract`;

const cssText = extractStyle(); // :where(.css-bAMboOo).ant-btn ...

use with custom theme

import extractStyle from `@lincy/static-style-extract`;

const cssText = extractStyle(); // :where(.css-bAMboOo).ant-btn ...

const cssText = extractStyle((node) => (
  <ConfigProvider theme={theme}>
    {node}
  </ConfigProvider>
));

use with custom module

import extractStyle from `@lincy/static-style-extract`;
import { Button, Input } from 'antd'

const cssText = extractStyle(); // :where(.css-bAMboOo).ant-btn ...

const cssText = extractStyle((node) => (
  <ConfigProvider theme={theme}>
    {node}
  </ConfigProvider>
), { Button, Input });

Example

http://localhost:8000

online example: http://react-component.github.io/static-style-extract/

Development

npm install
npm start

Test Case

npm test

Coverage

npm run coverage

open coverage/ dir

License

static-style-extract is released under the MIT license.

Readme

Keywords

Package Sidebar

Install

npm i @lincy/static-style-extract

Weekly Downloads

1

Version

1.0.5

License

MIT

Unpacked Size

10 kB

Total Files

11

Last publish

Collaborators

  • lincenying