csstools / postcss-advanced-variables

Use Sass-like variables, conditionals, and iterators in CSS
Creative Commons Zero v1.0 Universal
130 stars 33 forks source link

Handling multi-levels variables? #82

Open dtvn opened 5 years ago

dtvn commented 5 years ago

I have this vars:

const vars = {
    fontset: {
        size: '14px',
        body: '"Mali", cursive',
        head: '"Itim", cursive'
    }
}

module.exports = {
    plugins: {
        'postcss-advanced-variables': {
            variables: vars
        }
    }
}

How do I use fontset in css files? More exactly, does PAV supports this feature?

I think it's called map in SASS.

cliffordp commented 4 years ago

Yes, I want this as well.

image

gael-boyenval commented 4 years ago

@dtvn : did you tried to add the rest as a string or a template ?

const vars = {
    fontset: `(
        size: '14px',
        body: '"Mali", cursive',
        head: '"Itim", cursive'
    )`
}

module.exports = {
    plugins: {
        'postcss-advanced-variables': {
            variables: vars
        }
    }
}
cliffordp commented 4 years ago

FYI: I used Tailwind's theme to do this instead: https://tailwindcss.com/docs/theme/