PostCSS Design Convert
PostCSS plugin adjust the size of design draft when using viewport or rem layout. (e.g. cube-ui is based on 375*667, but project design draft is based on 750*1334)
Example
'postcss-design-convert' : multiple: 2 units: 'vw' selector: /^\.design-/
/* Input example */
/* Output example */
'postcss-design-convert' : multiple: 2 units: 'vw' selector: /\.design-/
/* Input example */
/* Output example */
'postcss-design-convert' : multiple: 2 units: 'vw' 'rem' selector: /\.design-/
/* Input example */
/* Output example */
'postcss-design-convert' : multiple: 2 units: 'vw' selector: /\.design-/ attribute: /width/
/* Input example */
/* Output example */
Usage
//postcss.config.jsmoduleexports = plugins: multiple: 2 units: 'vw' selector: /\.design-/ //.postcssrc.jsmoduleexports = 'plugins': 'postcss-design-convert' : multiple: 2 units: 'vw' selector: /\.design-/
Options
-
multiple (number) default 2: how many times the design draft needs to be multiplied
-
units (array<string>) default ['vw']: the units to be converted
-
selector (string | Reg) default /./: used to filter out the style to be converted (version compatibility reasons, alias [classRule])
-
attribute (string | Reg): used to filter out the attributes to be converted
See PostCSS docs for examples for your environment.