-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Vite: Utilities are not working when importing tailwind in a .scss
file
#14376
Comments
@Matheun Thanks for the report! Yeah the current version of the Tailwind CSS Vite plugin does not support other pre-processors like SCSS as Tailwind CSS itself is hooked in a pre-processor. I'll look into options of how to make this work though, but it's likely that enabling out-of-the-box support for SCSS requires jumping through some hoops.
As a work around, though, I believe you should be able to use the |
.scss
file
@philipp-spiess So what im trying to do is to create the following folder structure
I want to use it this way since at our company we got 2 parties, 1 that hates tailwind classes and the other that hates regular css. To bridge the gap between them, im creating a nuxt template for us that has regular scss config and tools along side tailwindcss. This way i can maintain the template and keep both parties working along side, since neither is willing to give in :) "As a work around, though, I believe you should be able to use the @tailwindcss/postcss plugin with Vite and run it after the SCSS transform?" |
Here's what I tried: I added the following module.exports = {
parser: 'postcss-scss',
plugins: {
'@tailwindcss/postcss': {},
},
} |
Awesome, this works wonders. |
Is there any new changes? I used to have the exact same setup for months and now it's suddenly not working anymore? node:internal/process/promises:391
triggerUncaughtException(err, true /* fromPromise */);
^
[Failed to load PostCSS config: Failed to load PostCSS config (searchPath: C:/Users/shadow/Desktop/Coding/neocities): [Error] Loading PostCSS Plugin
failed: Cannot find module '@alloc/quick-lru'
Require stack:
- C:\Users\shadow\Desktop\Coding\neocities\node_modules\tailwindcss\lib\lib\setupTrackingContext.js
- C:\Users\shadow\Desktop\Coding\neocities\node_modules\tailwindcss\lib\plugin.js
- C:\Users\shadow\Desktop\Coding\neocities\node_modules\tailwindcss\lib\index.js
- C:\Users\shadow\Desktop\Coding\neocities\postcss.config.js
(@C:\Users\shadow\Desktop\Coding\neocities\postcss.config.js)
Error: Loading PostCSS Plugin failed: Cannot find module '@alloc/quick-lru'
Require stack:
- C:\Users\shadow\Desktop\Coding\neocities\node_modules\tailwindcss\lib\lib\setupTrackingContext.js
- C:\Users\shadow\Desktop\Coding\neocities\node_modules\tailwindcss\lib\plugin.js
- C:\Users\shadow\Desktop\Coding\neocities\node_modules\tailwindcss\lib\index.js
- C:\Users\shadow\Desktop\Coding\neocities\postcss.config.js export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}; |
Are you using nuxt? |
No just regular Vue 3 using this guide: https://tailwindcss.com/docs/guides/vite#vue And just installing |
My stuff: {
"name": "neocities",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc -b && vite build",
"preview": "vite preview"
},
"dependencies": {
"vue": "^3.5.4",
"vue-router": "^4.4.3"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.1.3",
"autoprefixer": "^10.4.20",
"postcss": "^8.4.45",
"sass-embedded": "^1.78.0",
"tailwindcss": "^3.4.10",
"typescript": "^5.6.2",
"vite": "^5.4.3",
"vue-tsc": "^2.1.6"
}
} Main.ts import '@/scss/main.scss'; main.scss @use './tw.scss'; tw.scss @import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities'; |
EDIT: The new postcss package is broken. I downgraded the package to use Any higher version makes it break. |
ah, your currectly commenting on a tailwind v4 issue, your working with v3.4 |
Yeah. But if any luck you could try switching from |
Fun fact, you actually need to install sass 😉 |
Actually Nuxt suguessted to install sass-embedded. sass and sass-embedded are two different packages. sass is js based and sass-embessed is dart based. |
@ultimateshadsform If you open a new issue, i'll try and help you out there, since this issue isnt about your problem |
tailwind v4.0.0.23
Basically, tailwind utilities work fine when importing it using a css file, but the wont work when importing it in a scss file
my package.json
my nuxt.config.ts
my /assets/styles/tailwind.scss
my app.vue
The text was updated successfully, but these errors were encountered: