Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamic class not working #20

Closed
Aperrix opened this issue Mar 29, 2022 · 2 comments
Closed

dynamic class not working #20

Aperrix opened this issue Mar 29, 2022 · 2 comments

Comments

@Aperrix
Copy link

Aperrix commented Mar 29, 2022

DESCRIPTION

Hi everyone, i followed the doc of stencil-tailwind-plugin to setup it to my stencil-storybook project but it's not working.

As you can see to the screenshot the font-bold class is correctly working but the text color is not applied.

🔗 https://github.com/hotchpotch-lab/stencilfy/tree/1-setup-storybook

MY CODE

// stencil.config.ts

import { Config } from '@stencil/core';
import tailwind, { tailwindHMR } from 'stencil-tailwind-plugin';

export const config: Config = {
  namespace: 'stencilfy',
  devServer: {
    port: 4000,
    reloadStrategy: 'pageReload',
    openBrowser: false
  },
  outputTargets: [
    {
      type: 'dist',
      esmLoaderPath: '../loader',
    },
    {
      type: 'dist-custom-elements',
    },
    {
      type: 'docs-readme',
      footer: 'Built by Aperrix & Damokless'
    },
    {
      type: 'www',
      serviceWorker: null, // disable service workers
    },
  ],
  plugins: [
    tailwind(),
    tailwindHMR()
  ],
};
// my-component.tsx

export class MyComponent {
  /**
   * The first name
   */
  @Prop() first: string;


  /**
   * The middle name
   */
  @Prop() middle: string;


  /**
   * The last name
   */
  @Prop() last: string;


  /**
   * The text color
   */
  @Prop() textColor: string = 'black'


  private getText(): string {
    return format(this.first, this.middle, this.last);
  }


  render() {
    return <div class={`font-bold text-${this.textColor}-500`}>Hello, World! I'm {this.getText()}</div>;
  }
}

SCREENSHOTS

image

image

@Poimen
Copy link
Owner

Poimen commented Mar 29, 2022 via email

@Poimen
Copy link
Owner

Poimen commented Mar 30, 2022

Closing as I don't think there is an issue for the plugin to resolve. Please reopen if there is something more.

@Poimen Poimen closed this as completed Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants