tailwindcss: Migration tool doesn't recognize .scss files
What version of Tailwind CSS are you using?
3.4.17
What build tool (or framework if it abstracts the build tool) are you using?
Vite 6, Vue 3, postCSS
What version of Node.js are you using?
22
What browser are you using?
N/A
What operating system are you using?
Windows 11
Reproduction URL
No repro
Describe your issue
My project has a .scss file with Tailwindcss declaration, which is in turn imported in the main .ts file. Trying to run migration with npx @tailwindcss/upgrade@next returns the following error:
│ Searching for CSS files in the current directory and its subdirectories…
│ ↳ Cannot find any CSS files that reference Tailwind CSS.
│ Before your project can be upgraded you need to create a CSS file that imports Tailwind CSS or uses @tailwind.
The error disappears if I rename my .scss stylesheet to .css.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 28
- Comments: 35 (1 by maintainers)
Commits related to this issue
- chore(frontend): bump tailwindcss to v4 (#4665) # Motivation We want to bump `tailwindcss` to v4. However [the migration tool does not support SASS files](https://github.com/tailwindlabs/tailwindcss... — committed to dfinity/oisy-wallet by AntonioVentilii 2 years ago
- chore(frontend): bump tailwindcss to v4 (#4665) # Motivation We want to bump `tailwindcss` to v4. However [the migration tool does not support SASS files](https://github.com/tailwindlabs/tailwindcss... — committed to dfinity/oisy-wallet by AntonioVentilii 2 years ago
- chore(frontend): bump tailwindcss to v4 (#4665) # Motivation We want to bump `tailwindcss` to v4. However [the migration tool does not support SASS files](https://github.com/tailwindlabs/tailwindcss... — committed to dfinity/oisy-wallet by AntonioVentilii 2 years ago
Hey!
Sorry for the inconvenience here, however right now we don’t support migrating .scss or .less files. Doing so would require us to be able to understand the scss/sass and less syntax to make changes. But even if we do that, Tailwind CSS v4 isn’t really compatible with these files anyway (more info about compatibility: https://tailwindcss.com/docs/compatibility#sass-less-and-stylus)
I would recommend to see if you can rename the file(s) to
.cssand try again. You might notice that sometimes people use scss for features such as nested css, which should just work already in Tailwind CSS v4 (and modern browsers). So there is a good chance that you might not need.scssfiles at all.Again, sorry about the inconvenience here, but if you can migrate to normal .css files, then upgrading using the upgrade tool should just work.
https://tailwindcss.com/docs/compatibility
Don’t use scss anymore, use plain css files.
Every Angular project with Angular Material uses mixins, so it means such projects simply can’t upgrade to v4.
From my POW I see this as a failure … I am blocked to upgrade to new version and I will hope that v5 will be better …
Yeah, what if I’m using a custom scss theme in Angular Material?
An upgrade tool that doesn’t upgrade files the said upgrade doesn’t support anymore. Amazing.
It’s easier to say for a new project, but new projects don’t need this tool 😃
That make no sense at all!
Introducing a breaking change of this magnitude without a clear path toward upgrading outside of manually changing files to .css and crossing your fingers (followed by playing wack-a-mile to fix issues) is a huge miss. A ton of consumers of your package use sass, and you’ve essentially blocked many of them from upgrading because its not feasible to devote that much time while juggling business priorities
For anyone interested, I’ve written up a follow up post: Make Tailwind CSS v4 play nice with Angular Material.
I just ran into this issue, whilst not being aware this is such a breaking change. I am using SCSS because of angular Material library and I use tailwind MASSIVELY for its nice flex and margin/padding utilities. After recently migrating away from the discontinued angular-flex-layout library towards tailwind I got a near heartfailure seeing all of my tailwind work now no longer works in the upgraded Angular 19 project. Simple removing SCSS is not an option. I minimize using SCSS, I try to use tailwind everywhere. But I need it for my Material components.
Maybe the Tailwind team can reach out to the Angular team to make a fine integration between the two?
If you, like me, need Tailwindcss v4 for SCSS projects, you can connect it using PostCSS with SCSS syntax Working example: https://github.com/umkasanki/tailwindcss4/
+1 for angular Unable to upgrade on our projects
SCSS is a standard for a lot of projects. This means either full commitment on using tailwind or not at all. It opens a lot of troubles for projects which might have a combination of tailwind with some in house SCSS (I have read that it supports SASS on CSS files, but this does not make sense renaming all files from SCSS to CSS and writing SCSS with the hope that tailwind will do its job and follow the SCSS standards )
+1 angular and scss They are suggesting renaming all the scss files to css which is not acceptable for many of projects
My setup for angular NX and tailwind v4 and vscode:
tailwind and vscode tailwind extension (v0.14.6) seems to work so far
Best solution is to create a shared styles library and include it in every project.json
I think you can still use it. Just use regular .css for the rest of your project and other overrides. The main issue right now is with
@referenceI think as it requires massive rewrites at least in angular where you don’t have direct access to vite config and you can’t simply add an alias (don’t ask me why - angular sucks). So really it’s up to angular team to integrate it more gracefully or tailwind team to make using@referenceless cumbersome or add implicit references via some “main css file” config.The current situation is not ideal and while I will use v4 for other non-angular projects or new ones for angular I’ll stick with v3 until there’s some more backward-compatible
@applyin CSS modules solutionNot checked this yet - will do so later, I just want to add to the comments that it is sad that this issue was closed instead of moving it to the backlog.
I’ve made the mistake to upgrade to TW4 very early on learning only afterwards that SCSS files are not supported. Ironically, while it was experimental TW4 worked perfectly fine with SCSS. Now with the official release, the TW team decided to go as far as to purposely exclude SCSS files in the language service, afaik.
Setup is Tailwind - Angular - Angular Material. We were able to migrate, but development flow is quite janky, with things like Intellisense etc. not working. We are relying on
@importatm, but@importhas been deprecated and will be removed in Dart Sass 3.0.0.As it stands right now - it’s migrate away from TW, away from Material or Frankenstein them together somehow. TW4 is awesome, but this is a massive oversight.
I have to agree with @Celtian … you say that tailwindcss v4 supports SASS, but then the migration is done manually, with great risk of doing it wrong. This means that either we invest time in migrating a project, or we are stuck to v3 until a better solution appears.
Is there really no plan of making the migration tool work with SCSS files? It would be useful to know it for certain, since it requires quite a lot of work to do it manually on a big project.
AND is it official that tailwind should not be used with SCSS files?
Any news here? Same problem