Skip to content

fix: load correct tailwind config in monorepo #389

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

hyoban
Copy link

@hyoban hyoban commented Mar 3, 2025

Pull Request Name

Description

close #390

In the latest flat config, we can set different settings for different files, such as using different tailwind configs for files in different directories. However, the current cache does not handle caching of multiple files well, resulting in the configuration not taking effect, and we are still using the same tailwind configuration.

export default [
  {
    settings: {
      tailwindcss: {
        config: path.join(import.meta.dirname, "tailwind.config.ts"),
      },
    },
  },
  {
    files: ["apps/mobile/**/*"],
    settings: {
      tailwindcss: {
        config: path.join(import.meta.dirname, "apps/mobile/tailwind.config.ts"),
      },
    },
  },
]

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

  • OS + version: e.g. macOS Mojave
  • NPM version: ...
  • Node version: ...

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@@ -14,8 +14,8 @@ try {
const CHECK_REFRESH_RATE = 1_000;
let previousConfig = null;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hyoban I guess previousConfig should not be needed anymore if we keep a cache of all the configs we find?

also this part

const newConfig = convertConfigToString(twConfig) !== convertConfigToString(previousConfig);

it's probably also not necessary and we could check if the config is in the cache?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is better, thanks for your review!

Copy link
Author

@hyoban hyoban Mar 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code has been updated to apply your suggestion

11dff92 (#389)

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.

[BUG] Mixed configuration when working in a project with multiple configurations
2 participants