How to use the @vue/component-compiler-utils.compileStyle function in @vue/component-compiler-utils

To help you get started, we’ve selected a few @vue/component-compiler-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 vuejs / vue-jest / lib / process-style.js View on Github external
// pre process
  if (transformer.preprocess) {
    content = transformer.preprocess(content, filePath, config, stylePart.attrs)
  }

  // transform
  if (transformer.process) {
    content = transformer.process(content, filePath, config, stylePart.attrs)
  } else {
    const preprocessOptions = getPreprocessOptions(
      stylePart.lang,
      filePath,
      config
    )
    const result = compileStyle({
      source: content,
      filePath,
      preprocessLang: stylePart.lang,
      preprocessOptions,
      scoped: false
    })
    logResultErrors(result)
    content = result.code
  }

  // post process
  if (transformer.postprocess) {
    return transformer.postprocess(content, filePath, config, stylePart.attrs)
  }

  return JSON.stringify(extractClassMap(content))

@vue/component-compiler-utils

Lower level utilities for compiling Vue single file components

MIT
Latest version published 3 years ago

Package Health Score

66 / 100
Full package analysis