How to use the @teleporthq/teleport-types.PreactStyleVariation.CSSModules function in @teleporthq/teleport-types

To help you get started, we’ve selected a few @teleporthq/teleport-types 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 teleporthq / teleport-code-generators / packages / teleport-component-generator-preact / src / index.ts View on Github external
const createPreactComponentGenerator = (
  variation = PreactStyleVariation.CSSModules,
  { mappings = [], plugins = [], postprocessors = [] }: GeneratorFactoryParams = {}
): ComponentGenerator => {
  const generator = createComponentGenerator()
  const stylePlugins = {
    [PreactStyleVariation.InlineStyles]: inlineStylesPlugin,
    [PreactStyleVariation.CSSModules]: createCSSModulesPlugin({
      classAttributeName: 'class',
      moduleExtension: false,
    }),
    [PreactStyleVariation.CSS]: createCSSPlugin({
      templateChunkName: 'jsx-component',
      templateStyle: 'jsx',
      declareDependency: 'import',
      forceScoping: true,
    }),
  }
github teleporthq / teleport-code-generators / packages / teleport-project-generator-preact / src / index.ts View on Github external
const createPreactProjectGenerator = () => {
  const preactComponentGenerator = createPreactComponentGenerator(PreactStyleVariation.CSSModules, {
    mappings: [PreactProjectMapping as Mapping],
  })

  const preactPageGenerator = createPreactComponentGenerator(PreactStyleVariation.CSSModules, {
    plugins: [headConfigPlugin],
    mappings: [PreactProjectMapping as Mapping],
  })

  const routerPlugin = createReactAppRoutingPlugin({ flavor: 'preact' })
  const routingComponentGenerator = createComponentGenerator()
  routingComponentGenerator.addPlugin(routerPlugin)
  routingComponentGenerator.addPlugin(importStatementsPlugin)
  routingComponentGenerator.addPostProcessor(prettierJS)

  const htmlFileGenerator = createComponentGenerator()

  const generator = createProjectGenerator({
    components: {
      generator: preactComponentGenerator,
      path: ['src', 'components'],
github teleporthq / teleport-code-generators / packages / teleport-component-generator-preact / src / index.ts View on Github external
const createPreactComponentGenerator = (
  variation = PreactStyleVariation.CSSModules,
  { mappings = [], plugins = [], postprocessors = [] }: GeneratorFactoryParams = {}
): ComponentGenerator => {
  const generator = createComponentGenerator()
  const stylePlugins = {
    [PreactStyleVariation.InlineStyles]: inlineStylesPlugin,
    [PreactStyleVariation.CSSModules]: createCSSModulesPlugin({
      classAttributeName: 'class',
      moduleExtension: false,
    }),
    [PreactStyleVariation.CSS]: createCSSPlugin({
      templateChunkName: 'jsx-component',
      templateStyle: 'jsx',
      declareDependency: 'import',
      forceScoping: true,
    }),
  }
  const stylePlugin = stylePlugins[variation]
  if (!stylePlugin) {
    throw new Error(`Invalid style variation '${variation}'`)
  }

  generator.addMapping(PreactMapping)
github teleporthq / teleport-code-generators / packages / teleport-project-generator-preact / src / index.ts View on Github external
const createPreactProjectGenerator = () => {
  const preactComponentGenerator = createPreactComponentGenerator(PreactStyleVariation.CSSModules, {
    mappings: [PreactProjectMapping as Mapping],
  })

  const preactPageGenerator = createPreactComponentGenerator(PreactStyleVariation.CSSModules, {
    plugins: [headConfigPlugin],
    mappings: [PreactProjectMapping as Mapping],
  })

  const routerPlugin = createReactAppRoutingPlugin({ flavor: 'preact' })
  const routingComponentGenerator = createComponentGenerator()
  routingComponentGenerator.addPlugin(routerPlugin)
  routingComponentGenerator.addPlugin(importStatementsPlugin)
  routingComponentGenerator.addPostProcessor(prettierJS)

  const htmlFileGenerator = createComponentGenerator()