Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(exposeConfig): maximize nested exports #629

Merged
merged 3 commits into from
Mar 14, 2023
Merged

feat(exposeConfig): maximize nested exports #629

merged 3 commits into from
Mar 14, 2023

Conversation

ineshbose
Copy link
Collaborator

This PR aims to squeeze out as many exports possible from the nested exports feature introduced in #583.

Behaviour before PR with default exposeLevel: 2 for file #tailwind-config/theme/flexBasis (when maxLevel is hit and it is a terminating file):

export default {
  // all properties in one object
  "96": "24rem",
  "auto": "auto",
  "px": "1px",
  "0.5": "0.125rem",
  "1.5": "0.375rem",
  "2.5": "0.625rem",
  "3.5": "0.875rem",
  "1/2": "50%",
}

Behaviour after PR:

// ...all possible exports
const _96 = "24rem"
const _auto = "auto"
const _px = "1px"
const _full = "100%"

// same variables, along with unsafe vars
const config = { "96": _96, "auto": _auto, "px": _px, "full": _full, "0.5": "0.125rem", "1.5": "0.375rem", "2.5": "0.625rem", "3.5": "0.875rem", "1/2": "50%",  }

export { config as default, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _14, _16, _20, _24, _28, _32, _36, _40, _44, _48, _52, _56, _60, _64, _72, _80, _96, _auto, _px, _full }

(This will be the last PR for this feature - for a while at least - I promise 😉)

@what-the-diff
Copy link

what-the-diff bot commented Mar 13, 2023

  • The code was refactored to support non-alphanumeric keys in the tailwind config.
  • A new function populateMap() is added, which recursively iterates through all nested objects and arrays of an object (tailwind config). It also adds a template for each key/value pair found in the tailwind config file with filename #tailwing-config/${subpath}.mjs.

Copy link
Collaborator

atinux commented Mar 14, 2023

Tell me when good to review!

@ineshbose
Copy link
Collaborator Author

Its ready! 😄

@atinux atinux merged commit e2ca518 into nuxt-modules:main Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants