How to use the fela-tools.generateMonolithicClassName function in fela-tools

To help you get started, we’ve selected a few fela-tools 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 / src / enhancers / monolithic.js View on Github external
renderer._renderStyleToClassNames = (
    style: Object,
    rule: Function
  ): string => {
    if (Object.keys(style).length < 1) {
      return ''
    }

    const localRulePrefix = renderer.prettySelectors && rule.name
      ? `${rule.name}_`
      : ''

    const className = generateMonolithicClassName(
      style,
      (renderer.selectorPrefix || '') + (rule.selectorPrefix || localRulePrefix)
    )

    if (!renderer.cache.hasOwnProperty(className)) {
      renderer._renderStyleToCache(className, style)
      renderer.cache[className] = true
    }

    return className
  }