styletron-legacy

Legacy package for 1.x styletron

Usage no npm install needed!

<script type="module">
  import styletronLegacy from 'https://cdn.skypack.dev/styletron-legacy';
</script>

README

styletron

build status dependencies status npm version

A generic server-rendering helper for css-in-js tools

This module provides functionality for:

  • Injection of CSS into the document head in browsers
    • Buffering of multiple injections into a single update
    • Ignoring of duplicate style injections
  • Extraction of CSS at render-time on the server, which can be sent down along with markup

This concept behind this module is originally from https://github.com/Khan/aphrodite, but this module is smaller in scope and more generic.

Usage

Injecting a style into document <head>

const styletron = require('styletron');
styletron.injectOnce('.foo { color: red }', 'someUniqueId');

Extracting "injected" CSS at render-time on the server

See styletron-server

API documentation