Merge pull request #1915 from valtism/master

Provide a default tracking with Font Size config
This commit is contained in:
Adam Wathan 2020-08-06 15:24:42 -04:00 • committed by GitHub
commit 2c05a4a633
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,7 +4,11 @@ export default function() {
return function({ addUtilities, e, theme, variants }) {
const utilities = _.fromPairs(
_.map(theme('fontSize'), (value, modifier) => {
const [fontSize, lineHeight] = Array.isArray(value) ? value : [value]
const [fontSize, options] = Array.isArray(value) ? value : [value]
// Tailwind 1.3+ syntax allowed line height to be specified in the array like
// ['16px', '24px'], so we can get it from there as well as from object syntax
const lineHeight = options instanceof Object ? options.lineHeight : options
const letterSpacing = options && options.letterSpacing
return [
`.${e(`text-${modifier}`)}`,
@ -15,6 +19,11 @@ export default function() {
: {
'line-height': lineHeight,
}),
...(letterSpacing === undefined
? {}
: {
'letter-spacing': letterSpacing,
}),
},
]
})