-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Migration tool doesn't recognize .scss files #15716
Comments
same problem. |
Same here, in my Angular project, with scss. |
https://tailwindcss.com/docs/compatibility Don't use scss anymore, use plain css files. |
It’s easier to say for a new project, but new projects don’t need this tool :) |
Yeah, what if I'm using a custom scss theme in Angular Material? |
Hey Angulars, If your scss file contains // comments then it will break the tailwind v4 instead use /* comment */. @adamwathan FYI. |
I'm having the same issue -- .scss file is blocking the upgrade. |
Any news here? Same problem |
Same issue here, I can temporarily change it to a regular .css file but this would require quite a few adjustments in these files. |
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 Again, sorry about the inconvenience here, but if you can migrate to normal .css files, then upgrading using the upgrade tool should just work. |
Every Angular project with Angular Material uses mixins, so it means such projects simply can't upgrade to v4. |
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 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 |
I've written up how I'm migrating Angular projects (with Sass) to Tailwind v4: https://jits.dev/blog/migrating-angular-tailwind-v4/ |
@jits, it's for migrating the config only, and only for cases when your config can be migrated. 0 SCSS/CSS files are updated, and most of the "juice" is in SCSS files and templates, not in config. |
@e-oz — I don't follow your point; have you read my post? In my case, CSS and templates are being updated (if you follow the "manual" approach I recommend). |
I did read your article and the only updated CSS file is what you created in root. |
@e-oz — yes, that's why in my post I say:
… and I then go on to explain the steps you need to take to manually apply the changes back to your main styles file:
As far as I know, there's no way to get the Tailwind v4 upgrade tool to work on SCSS files directly (which is the point of this GitHub repo issue, and confirmed by |
|
@e-oz — At this point I'll bow out of this conversation, as I can only assume you haven't read my post properly.
I don't make this assertion anywhere. YMMV. |
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? |
@AntonioVentilii Tailwind (not the migration tool) works fine with SCSS files if they don’t have comments like |
@e-oz what I meant is that I would like to upgrade tailwindcss in my project, which has a lot of SASS files and uses a lot of tailwind classes. However, the upgrade tool does not work in my case because it says that there is no reference to tailwindcss in any file. That is because it does not recognise the scss files, and so it does not apply the migration, nowhere, not even in the classes used in other types of files. |
From my POW I see this as a failure ... I am blocked to upgrage to new version nad I will hope that v5 will be better ... |
I managed to get Tailwind V4 running in Angular V19 with custom SCSS through Angular Material Components. However, while SCSS changes are detected when saved, no actual changes are recognized. No output file changes. |
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. |
# Motivation We want to bump `tailwindcss` to v4. However [the migration tool does not support SASS files](tailwindlabs/tailwindcss#15716). # Workaround We changed all the `.scss` files to a copy in `.css` and use the migration tool, and then reverted. Same thing with the language in the `<style>` tag of Svelte components. Then we added a few manual tweaks anyway. # Disclaimer Since a part of the PR was a manual process, it may very well be that I missed something or there is some error in migration. # Note Apparently `prettier-plugin-tailwindcss` was bumped too, so a few changes happened in the sorting order of the tailwind classes too. That is the reason for this many files changed in this PR, since we have an auto-formatter. Furthermore, it seems that [a few classes will require a Vite update to work properly](vitejs/vite#18974). For example `space-x-*` and `space-y-*`. # Changes - The migration tool: - installed `tailwindcss` v4; - changed `postcss.config`; - migrated the tailwind classes that required migration (see [upgrade guide](https://tailwindcss.com/docs/upgrade-guide)); - correctly changed `global.css` (that we reverted to `global.scss` after). - A few changes were missing, and we did it manually: - The `Hero` gradient does not need a `via-` color anymore, it can changed to `from-`. - The util `@screen foo` is deprecated and should be replaced with `@media (width >= theme(--breakpoint-foo))` (see [codebase of tailwindcss migration](https://github.com/tailwindlabs/tailwindcss/blob/121cf6bd807a35ad9814dd5444eeb3594601fff8/packages/%40tailwindcss-upgrade/src/codemods/migrate-media-screen.test.ts)). - It is [suggested](https://tailwindcss.com/docs/upgrade-guide#using-vite) to install and add `@tailwindcss/vite` in `vite` (and `vitest`) configs; - Move `@include meta.load-css(...)` inside `@layer base {...}` (suggestion in [tailwindcss discussion](tailwindlabs/tailwindcss#16421)). - We create another branch to make the changes manually following the [upgrade guide](https://tailwindcss.com/docs/upgrade-guide) and they matched: - #4666 # Tests There is not much test to help us, apart update the E2E snapshots and manual navigation in local replica: https://github.com/user-attachments/assets/d0ae2e36-7fff-4ff8-8829-3c93e900650a --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
# Motivation We want to bump `tailwindcss` to v4. However [the migration tool does not support SASS files](tailwindlabs/tailwindcss#15716). # Workaround We changed all the `.scss` files to a copy in `.css` and use the migration tool, and then reverted. Same thing with the language in the `<style>` tag of Svelte components. Then we added a few manual tweaks anyway. # Disclaimer Since a part of the PR was a manual process, it may very well be that I missed something or there is some error in migration. # Note Apparently `prettier-plugin-tailwindcss` was bumped too, so a few changes happened in the sorting order of the tailwind classes too. That is the reason for this many files changed in this PR, since we have an auto-formatter. Furthermore, it seems that [a few classes will require a Vite update to work properly](vitejs/vite#18974). For example `space-x-*` and `space-y-*`. # Changes - The migration tool: - installed `tailwindcss` v4; - changed `postcss.config`; - migrated the tailwind classes that required migration (see [upgrade guide](https://tailwindcss.com/docs/upgrade-guide)); - correctly changed `global.css` (that we reverted to `global.scss` after). - A few changes were missing, and we did it manually: - The `Hero` gradient does not need a `via-` color anymore, it can changed to `from-`. - The util `@screen foo` is deprecated and should be replaced with `@media (width >= theme(--breakpoint-foo))` (see [codebase of tailwindcss migration](https://github.com/tailwindlabs/tailwindcss/blob/121cf6bd807a35ad9814dd5444eeb3594601fff8/packages/%40tailwindcss-upgrade/src/codemods/migrate-media-screen.test.ts)). - It is [suggested](https://tailwindcss.com/docs/upgrade-guide#using-vite) to install and add `@tailwindcss/vite` in `vite` (and `vitest`) configs; - Move `@include meta.load-css(...)` inside `@layer base {...}` (suggestion in [tailwindcss discussion](tailwindlabs/tailwindcss#16421)). - We create another branch to make the changes manually following the [upgrade guide](https://tailwindcss.com/docs/upgrade-guide) and they matched: - #4666 # Tests There is not much test to help us, apart update the E2E snapshots and manual navigation in local replica: https://github.com/user-attachments/assets/d0ae2e36-7fff-4ff8-8829-3c93e900650a --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
# Motivation We want to bump `tailwindcss` to v4. However [the migration tool does not support SASS files](tailwindlabs/tailwindcss#15716). # Workaround We changed all the `.scss` files to a copy in `.css` and use the migration tool, and then reverted. Same thing with the language in the `<style>` tag of Svelte components. Then we added a few manual tweaks anyway. # Disclaimer Since a part of the PR was a manual process, it may very well be that I missed something or there is some error in migration. # Note Apparently `prettier-plugin-tailwindcss` was bumped too, so a few changes happened in the sorting order of the tailwind classes too. That is the reason for this many files changed in this PR, since we have an auto-formatter. Furthermore, it seems that [a few classes will require a Vite update to work properly](vitejs/vite#18974). For example `space-x-*` and `space-y-*`. # Changes - The migration tool: - installed `tailwindcss` v4; - changed `postcss.config`; - migrated the tailwind classes that required migration (see [upgrade guide](https://tailwindcss.com/docs/upgrade-guide)); - correctly changed `global.css` (that we reverted to `global.scss` after). - A few changes were missing, and we did it manually: - The `Hero` gradient does not need a `via-` color anymore, it can changed to `from-`. - The util `@screen foo` is deprecated and should be replaced with `@media (width >= theme(--breakpoint-foo))` (see [codebase of tailwindcss migration](https://github.com/tailwindlabs/tailwindcss/blob/121cf6bd807a35ad9814dd5444eeb3594601fff8/packages/%40tailwindcss-upgrade/src/codemods/migrate-media-screen.test.ts)). - It is [suggested](https://tailwindcss.com/docs/upgrade-guide#using-vite) to install and add `@tailwindcss/vite` in `vite` (and `vitest`) configs; - Move `@include meta.load-css(...)` inside `@layer base {...}` (suggestion in [tailwindcss discussion](tailwindlabs/tailwindcss#16421)). - We create another branch to make the changes manually following the [upgrade guide](https://tailwindcss.com/docs/upgrade-guide) and they matched: - #4666 # Tests There is not much test to help us, apart update the E2E snapshots and manual navigation in local replica: https://github.com/user-attachments/assets/d0ae2e36-7fff-4ff8-8829-3c93e900650a --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
+1 for angular SCSS is a standard for a lot of projects. +1 angular and scss My setup for angular NX and tailwind v4 and vscode:
{
"plugins": {
"@tailwindcss/postcss": {}
}
}
...
"styles": [
"REPLACE_WITH_PROJECT_DIR/styles.scss",
"REPLACE_WITH_PROJECT_DIR/styles.css"
]
... 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 just ran into this issue, whilst not being aware this is such a breaking change. Maybe the Tailwind team can reach out to the Angular team to make a fine integration between the two? |
For anyone interested, I've written up a follow up post: Make Tailwind CSS v4 play nice with Angular Material. |
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.
The text was updated successfully, but these errors were encountered: