Skip to content

Export to sass variables fail if color is defined as function #53

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

Open
7iomka opened this issue Jan 10, 2022 · 1 comment
Open

Export to sass variables fail if color is defined as function #53

7iomka opened this issue Jan 10, 2022 · 1 comment

Comments

@7iomka
Copy link

7iomka commented Jan 10, 2022

https://tailwindcss.com/docs/customizing-colors#using-css-variables

function withOpacityValue(variable) {
  return ({ opacityValue }) => {
    if (opacityValue === undefined) {
      return `rgb(var(${variable}))`;
    }
    return `rgb(var(${variable}-rgb) / ${opacityValue})`;
  };
}

module.exports = {
  theme: {
    colors: {
      primary: withOpacityValue(`--primary`),
    },
 }
}

Error

SassError: expected ")".
  ╷
3 │   "primary": ({ opacityValue }) => {
  │               ^
@7iomka 7iomka changed the title Fail if color is defined as function Export to sass variables fail if color is defined as function Jan 10, 2022
@dobromir-hristov
Copy link
Owner

Hey. Sorry for the extremely late reply... I havent been active in the OSS world lately.

I can detect functions and invoke them, but I dont know what value to pass to them :/ Tailwind just gives me an object with functions as values for colors in your example.

I looked at the result from using this syntax in the tailwind playground and it looks pretty cool. I honestly have no clue how to proceed here. The Tailwind team doesnt really respond to my questions related to this library so that's a dead end as well :/

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