Skip to content

Instantly share code, notes, and snippets.

@Armanio
Created February 25, 2021 16:07
Show Gist options
  • Save Armanio/2b5bfdbf5dfa1b67d6cf5931170ba4f8 to your computer and use it in GitHub Desktop.
Save Armanio/2b5bfdbf5dfa1b67d6cf5931170ba4f8 to your computer and use it in GitHub Desktop.
const polishedFnsCategories = {
adjustHue: "color",
animation: "shorthands",
backgroundImages: "shorthands",
backgrounds: "shorthands",
between: "mixins",
border: "shorthands",
borderColor: "shorthands",
borderRadius: "shorthands",
borderStyle: "shorthands",
borderWidth: "shorthands",
buttons: "shorthands",
clearFix: "mixins",
complement: "color",
cover: "mixins",
cssVar: "helpers",
darken: "color",
desaturate: "color",
directionalProperty: "helpers",
easeIn: "easings",
easeInOut: "easings",
easeOut: "easings",
ellipsis: "mixins",
em: "helpers",
fluidRange: "mixins",
fontFace: "mixins",
getContrast: "color",
getLuminance: "color",
getValueAndUnit: "helpers",
grayscale: "color",
invert: "color",
hideText: "mixins",
hideVisually: "mixins",
hiDPI: "mixins",
hsl: "color",
hsla: "color",
hslToColorString: "color",
important: "helpers",
lighten: "color",
linearGradient: "mixins",
margin: "shorthands",
math: "math",
meetsContrastGuidelines: "color",
mix: "color",
modularScale: "helpers",
normalize: "mixins",
opacify: "color",
padding: "shorthands",
parseToHsl: "color",
parseToRgb: "color",
position: "shorthands",
radialGradient: "mixins",
readableColor: "color",
rem: "helpers",
remToPx: "helpers",
retinaImage: "mixins",
rgb: "color",
rgba: "color",
rgbToColorString: "color",
saturate: "color",
setHue: "color",
setLightness: "color",
setSaturation: "color",
shade: "color",
size: "shorthands",
stripUnit: "helpers",
textInputs: "shorthands",
timingFunctions: "mixins",
tint: "color",
toColorString: "color",
transitions: "shorthands",
transparentize: "color",
triangle: "mixins",
wordWrap: "mixins",
};
module.exports = {
presets: ["@babel/env"],
plugins: [
[
"transform-imports",
{
polished: {
transform: (importName) =>
`polished/lib/${polishedFnsCategories[importName]}/${importName}`,
preventFullImport: true,
},
},
],
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment