postcss / postcss-mixins

PostCSS plugin for mixins
MIT License
462 stars 47 forks source link

Fallback properties #121

Closed Antonio-Laguna closed 3 years ago

Antonio-Laguna commented 3 years ago

Hi here!

I've been using this awesome plugin for a while and today I got to wonder how to set up a fallback. Imagine a simple mixin that uses properties that are not in all browsers and I want to provide a fallback.

module.exports = function (rule) {
  const styles = {};

  styles['font-size'] = '16px';
  styles['font-size'] = 'clamp(...)';

  return styles;
};

Given that clamp is not available on old browsers, how could I make sure that both values are passed?

ai commented 3 years ago

Will it work as you expected?

styles['font-size'] = ['16px', 'clamp()']
Antonio-Laguna commented 3 years ago

Works like a charm! Thanks! Sorry if this was a dumb question but I couldn't find it mentioned anywhere.

ai commented 3 years ago

Nope. The problem is lack of docs for mixins API :)