Skip to content

Ensure classes defined in Nuxt config are imported #1013

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 1 commit into
base: main
Choose a base branch
from

Conversation

pedantic-git
Copy link

πŸ”— Linked issue

Resolves #1011

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

As discussed with @ineshbose in #1011, moving to the new directory structure of Nuxt 4 causes the two class keys in nuxt.config.ts to no longer be caught by Tailwind. This PR puts them back using the inline() keyword.

Note that it also had to move JSON.stringify higher up in the code, since these need stringifying inside the keyword. This shouldn't cause any issues because the variable is private and only used once.

Happy to make any changes requested!

Copy link

netlify bot commented Jul 23, 2025

πŸ‘· Deploy request for nuxt-tailwindcss pending review.

Visit the deploys page to approve it

Name Link
πŸ”¨ Latest commit 197921d

Copy link

what-the-diff bot commented Jul 23, 2025

PR Summary

  • Refinement of importCSS function
    The importCSS function has been updated for better usability. It now turns the directory paths of source files into strings when compiling these files. This simplifies the process of accessing and managing source files.

  • Expanding the parsing parameters
    We've added new variables to the sources array for parsing from the Nuxt configuration. This particularly affects htmlAttrs.class and bodyAttrs.class, providing greater control and flexibility in parsing these classes.

  • Enabling Inline Source Definitions
    The PR includes an enhancement that lets developers define source definitions inline. This is based on the configuration values if any are present.

  • Refactoring of getContents Method
    The getContents method, used for generating sources in CSS, has undergone modifications. We've removed the JSON.stringify operation from source values. This makes the process more streamlined, increasing efficiency and simplicity.

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.

Consider app.bodyAttrs.class from nuxt.config in scanning
1 participant