postcss-object-fit-images
Advanced tools
Comparing version 1.0.0 to 1.1.0
29
index.js
@@ -27,13 +27,20 @@ 'use strict'; | ||
if (!fontFamily && objPosition) { | ||
decl.cloneBefore({ | ||
prop: 'font-family', | ||
value: `"object-fit: ${objFit}; object-position: ${objPosition}"` | ||
}); | ||
} else if (!fontFamily) { | ||
decl.cloneBefore({ | ||
prop: 'font-family', | ||
value: `"object-fit: ${objFit}"` | ||
}); | ||
const value = [ | ||
'object-fit:' + objFit | ||
]; | ||
if (objPosition) { | ||
value.push('object-position:' + objPosition); | ||
} | ||
const props = { | ||
prop: 'font-family', | ||
value: '"' + value.join(';') + '"' | ||
}; | ||
// keep existing font-family | ||
if (fontFamily) { | ||
props.value += ', ' + fontFamily; | ||
} | ||
decl.cloneBefore(props); | ||
}; | ||
@@ -46,4 +53,4 @@ | ||
return function (css) { | ||
css.walkDecls(/(^object-fit$)/, declWalker); | ||
css.walkDecls('object-fit', declWalker); | ||
}; | ||
}); |
{ | ||
"name": "postcss-object-fit-images", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "PostCSS plugin that updates the standard object-fit tag to work with the object-fit-images polyfill for browsers that do not natively support object-fit.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
4155
38