mirror of
https://github.com/yldio/copilot.git
synced 2024-11-28 14:10:04 +02:00
REM Function - updating function to allow for multiple values to be pased in single arguement
This commit is contained in:
parent
b3bc167898
commit
0a08aa84df
@ -17,11 +17,16 @@ const plugins = {
|
||||
require('postcss-modules-values'),
|
||||
require('postcss-functions')({
|
||||
functions: {
|
||||
remCalc: function(pixels) {
|
||||
pixels = pixels.replace('px', '');
|
||||
const baseValue = 16;
|
||||
const remSize = pixels / baseValue;
|
||||
return `${remSize}rem`;
|
||||
remCalc: function(values) {
|
||||
values = values.replace('px', '');
|
||||
values = values.split(' ');
|
||||
let outputRems = '';
|
||||
const base = 16;
|
||||
values.forEach( (value, i) => {
|
||||
const remValue = value / base;
|
||||
outputRems += i === 0 ? `${remValue}rem` : ` ${remValue}rem`;
|
||||
});
|
||||
return outputRems;
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user