Skip to content

Conversation

@ineshbose
Copy link
Collaborator

@ineshbose ineshbose commented Apr 9, 2025

resolves #842

@what-the-diff
Copy link

what-the-diff bot commented Apr 9, 2025

PR Summary

  • Enhanced Configuration Flexibility in tailwind.config.ts File
    This change includes an update in the tailwind.config.ts file, utilizing the newly defined defineConfig function imported from src/config.ts. This enhancement improves the flexibility of configuration management.

  • Determination of Running Context within the defineConfig Function
    New logic has been implemented in the defineConfig function. This decides if the current context is Nuxt, a popular framework for developing Vue.js applications, and changes how configurations are processed accordingly.

  • Tailored Configuration Based on Running Context
    We've improved the defineConfig function further to return configurations suited to the specific running context. This means it can respond differently based on whether it's being run as a main file or within a Nuxt Environment. This upgrade improves our ability to handle different scenarios with maximum efficiency.

@netlify
Copy link

netlify bot commented Apr 9, 2025

Deploy Preview for nuxt-tailwindcss ready!

Name Link
🔨 Latest commit 99cc0f6
🔍 Latest deploy log https://app.netlify.com/sites/nuxt-tailwindcss/deploys/680a13f3f47732000851a2c0
😎 Deploy Preview https://deploy-preview-979--nuxt-tailwindcss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

src/config.ts Outdated
const _defineConfig = createDefineConfig<Partial<Config>>()
export const defineConfig: typeof _defineConfig = (config) => {
const isNuxt = !!tryUseNuxt()
return isNuxt ? config : isMainFile ? requireModule('.nuxt/tailwind/postcss.mjs') : config
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@danielroe

Could I get a review here possibly?

The use-case is for IntelliSense - if it is used in Nuxt build-time, just return the defined config.

If it is being loaded from the IntelliSense plugin, return .nuxt/tailwind/postcss.mjs contents which will in-turn re-import this file/config, so if it is being imported from there, return the object instead of trying to re-require postcss.mjs causing a cyclic import.

Quite fragile stuff, but I'm thinking I could ship it and based on feedback, remove it if not helpful as it is a non-app functionality feature/change.

@ineshbose
Copy link
Collaborator Author

stupid stuff, the intellisense plugins don't run the config but jiti-import it. need to check for that instead and will reopen when I have something

@ineshbose ineshbose closed this Apr 24, 2025
@ineshbose ineshbose reopened this Apr 24, 2025
@ineshbose ineshbose merged commit 9cc0bd5 into main Apr 25, 2025
10 checks passed
@ineshbose ineshbose deleted the define-config branch April 26, 2025 12:15
"@nuxtjs/tailwindcss": "link:.",
"@nuxt/ui": "npm:@nuxt/ui-edge"
"@nuxt/ui": "npm:@nuxt/ui-edge",
"unicorn-magic": "0.2.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @ineshbose, do you happen to have more info on why this resolution is necessary? I noticed after updating to 6.14.0 that the docker builds for our app broke, but adding this resolution to our package.json fixed things. But that was just a random troubleshooting step, and I'd be curious about the root cause.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hey - yes it is an odd issue. You can do down this thread to investigate #954, but even I would be slightly confused 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

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.

[DX] Expose defineConfig utility

3 participants