How to use the fela-utils.reflushStyleNodes function in fela-utils

To help you get started, we’ve selected a few fela-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 robinweser / fela / packages / fela-dom / src / DOMInterface.js View on Github external
export default function createDOMInterface(renderer: DOMRenderer): Function {
  renderer.styleNodes = reflushStyleNodes()
  const baseNode = renderer.styleNodes[RULE_TYPE]

  return function changeSubscription(change) {
    if (change.type === CLEAR_TYPE) {
      for (const node in renderer.styleNodes) {
        renderer.styleNodes[node].textContent = ''
      }

      return
    }

    const styleNode = getStyleNode(
      renderer.styleNodes,
      baseNode,
      change.type,
      change.media
github robinweser / fela / packages / fela-dom / src / initStyleNodes.js View on Github external
export default function initStyleNodes(renderer: Object): void {
  renderer.styleNodes = reflushStyleNodes()
  const baseNode = renderer.styleNodes[RULE_TYPE]

  for (const style in sheetMap) {
    if (renderer[style].length > 0) {
      initNode(renderer.styleNodes, baseNode, renderer[style], sheetMap[style])
    }
  }

  for (const media in renderer.mediaRules) {
    const mediaCSS = renderer.mediaRules[media]

    if (mediaCSS.length > 0) {
      initNode(renderer.styleNodes, baseNode, mediaCSS, RULE_TYPE, media)
    }
  }
}