How to use the styletron-utils.injectStyle function in styletron-utils

To help you get started, we’ve selected a few styletron-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jxnblk / axs / src / cx.js View on Github external
export const cx = (styles) => {
  const sx = formatStyles(styles)

  return injectStyle(styletron, sx)

  // return renderer.renderRule(() => sx)
}
github styletron / styletron / packages / benchmarks / renderers / styletron.js View on Github external
module.exports = (rules, synthetic) => {
  const len = rules.length;
  let first;
  let last;
  let middle;
  const styletron = new StyletronServer();
  for (let i = 0; i < len; i++) {
    let className = StyletronUtils.injectStyle(styletron, rules[i]);
    if (i === 0) {
      first = className;
    } else if (i === 1000) {
      middle = className;
    } else if (i === len - 1) {
      last = className;
    }
  }

  const styleElement = synthetic
    ? `<style class="styletron"></style>`
    : styletron.getStylesheetsHtml();

  return `

github tabazevedo / styletron-connect / src / internals.js View on Github external
Object.keys(st).forEach(k => {
      styles[k] = typeof st[k] === 'object'
        ? injectStyle(styletron, st[k])
        : st[k];
    });
    return styles;
github styletron / styletron / packages / styletron-react / src / connect-to-styles.js View on Github external
const classMap = Object.keys(styles).reduce((acc, key) => {
          acc[key] = utils.injectStyle(this.context.styletron, styles[key])
          return acc;
        }, {});
        return React.createElement(Component, Object.assign({

styletron-utils

Generic helper utilities for Styletron

MIT
Latest version published 7 years ago

Package Health Score

53 / 100
Full package analysis

Similar packages