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

Support for variables from: root #11

Closed
afuno opened this issue Aug 27, 2020 · 7 comments
Closed

Support for variables from: root #11

afuno opened this issue Aug 27, 2020 · 7 comments
Labels
enhancement New feature or request

Comments

@afuno
Copy link

afuno commented Aug 27, 2020

I noticed that now there is a problem if variables were declared, for example, in ':root'. Is there any solution for this problem now?

Снимок экрана 2020-08-28 в 00 31 06

@rogden rogden added the enhancement New feature or request label Aug 29, 2020
@rogden
Copy link
Owner

rogden commented Aug 29, 2020

This is an interesting use case. The config viewer doesn't load your compiled CSS file so it wouldn't have access to your CSS variables by default. One possible solution: I could add support for overrides/customization of the config viewer from your Tailwind config file. Example:

// in your tailwind.config.js file
module.exports = {
  theme: {
    // ... your theme config
    configViewer: {
      cssColorVars: {
        'var(--color-black)': '#000000',
        'var(--color-white)': '#ffffff',
        // ...other colors vars
      }
    }
  }
}

What do you think? Also, are you using CSS vars for theming? If so, this would only solve for your default/::root color vars.

@rogden
Copy link
Owner

rogden commented Sep 6, 2020

@afuno I added the ability to replace values from your theme when used in the config viewer. This should solve your issue with the CSS variables. See: https://github.com/rogden/tailwind-config-viewer#themereplacements

@rogden rogden closed this as completed Sep 6, 2020
@afuno
Copy link
Author

afuno commented Sep 8, 2020

@rogden Thanks. Everything is successful.

@kissu
Copy link

kissu commented Jan 13, 2021

If we do have an .scss file containing

:root {
  --color-dark-500: hsl(0, 0%, 21%);
  --color-white: hsl(0, 0%, 100%);
  ...
 }

It means that we pretty much need to copy-pasta the style file to the tailwind config, one by one ? 😖

@solidevolution
Copy link

solidevolution commented May 10, 2022

This should work without duplication in js because single source of truth are the css variables in :root

@mokone91
Copy link

mokone91 commented Feb 7, 2023

but how can i connect my 'tokens.css' to theme-viewer without parsing it to replacements?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants