css-suspense

1.0.2 • Public • Published

css-suspense

loading css files, the suspense way.

(what is suspense?)

requirements

  • don't inline css into the js bundle
  • while server rendering, inline <link> tags, enabling progressive css
  • on client side, suspend rendering till the css loads (with optional fallback ui)
  • render synchronously if already loaded

api

the api is a boring Stylesheet tag.

<Stylesheet href='/path/to/style.css'/>
{/* this content will not render to dom
  until the stylesheet finishes loading */}   
<span className='big'>what up what up</span>

todo

  • unload styles that aren't used (needs SimpleCacheProvider::invalidate)
  • tests etc etc

Readme

Keywords

none

Package Sidebar

Install

npm i css-suspense

Weekly Downloads

2

Version

1.0.2

License

MIT

Unpacked Size

2.25 MB

Total Files

31

Last publish

Collaborators

  • threepointone