UNPKG

@baleada/tailwind-theme-utils

Version:

Utility functions for Tailwind config files.

43 lines (38 loc) 1.08 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); function toMidfixed({ midfix, config }) { return Object.keys(config) .reduce((midfixed, value) => ({ ...midfixed, [`${midfix}-${value}`]: config[value], }), {}); } function rem(config) { return toMidfixed({ midfix: 'rem', config }); } function em(config) { return toMidfixed({ midfix: 'em', config }); } function px(config) { return toMidfixed({ midfix: 'px', config }); } function screen(config) { return toMidfixed({ midfix: 'screen', config }); } function withoutColorPalettes(colors) { const hues = Object.keys(colors); return hues .filter(hueOrKeyword => typeof colors[hueOrKeyword] === 'string') .reduce((keywords, keyword) => ({ ...keywords, [keyword]: colors[keyword] }), {}); } function apply(classes) { return { [`@apply ${classes}`]: {} }; } exports.apply = apply; exports.em = em; exports.px = px; exports.rem = rem; exports.screen = screen; exports.withoutColorPalettes = withoutColorPalettes;