diff --git a/package.json b/package.json index 310bf99..1613e28 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tailwindcss-fluid-type", - "version": "v2.0.0-alpha.2", + "version": "v2.0.0-alpha.3", "description": "Bring fluid type to tailwindcss", "main": "src/index.js", "license": "MIT", diff --git a/src/utils/calcModularScale.js b/src/utils/calcModularScale.js index 5dfff5c..ed89833 100644 --- a/src/utils/calcModularScale.js +++ b/src/utils/calcModularScale.js @@ -1,14 +1,14 @@ const defaults = require("../config/defaults"); module.exports = (value, data) => { - if (data.settingsAreNumbers && data.settings && defaults.settings) { - const sFtMin = data.settings?.fontSizeMin || defaults.settings?.fontSizeMin - const sFtMax = data.settings?.fontSizeMax || defaults.settings?.fontSizeMax - const sFtRMin = data.settings?.ratioMin || defaults.settings?.ratioMin - const sFtRMax = data.settings?.ratioMax || defaults.settings?.ratioMax - const sFtSMin = data.settings?.screenMin || defaults.settings?.screenMin - const sFtSMax = data.settings?.screenMax || defaults.settings?.screenMax - const unit = data.settings?.unit || defaults.settings?.unit + if (data.settingsAreNumbers && data.settings) { + const sFtMin = data.settings?.fontSizeMin + const sFtMax = data.settings?.fontSizeMax + const sFtRMin = data.settings?.ratioMin + const sFtRMax = data.settings?.ratioMax + const sFtSMin = data.settings?.screenMin + const sFtSMax = data.settings?.screenMax + const unit = data.unit const sFtUnit = typeof unit === 'string' ? unit : 'rem'; const ftMin = sFtMin * Math.pow(sFtRMin, value); const ftMax = sFtMax * Math.pow(sFtRMax, value); diff --git a/src/utils/createData.js b/src/utils/createData.js index 97a91c0..d85e1c9 100644 --- a/src/utils/createData.js +++ b/src/utils/createData.js @@ -12,6 +12,7 @@ module.exports = (options, data) => { // Add prefix data.prefix = options.settings?.prefix || defaults.settings?.prefix || '' + data.unit = options.settings?.unit || defaults.settings?.unit || 'rem' // Add number check data.settingsAreNumbers = Object