You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
split used css to separate css files after production build. #736
hello my friends.
i use from nuxt 3 and tailwind module.
after build project, all of used tailwind css classess, injected in head tag as internal css styles and this is not ok for SEO.
i want all of used class injected in separate css files after production build.
Thank you in advance for your help
changed the title [-]split used css to separate css files after buxt build.[/-][+]split used css to separate css files after production build.[/+]on Oct 21, 2023
now used tailwind classes injected in head of html page. i want split it into separate files that i can see them in chrome network tab as separete *.css files
@ineshbose
I noticed that if i set ssr: false in nuxt.config.ts, the css files split to separate files and everything is ok.
but i dont want set ssr to false.because my project is SEO based
I hope @/assets/css/main.scss isn't related to Tailwind because the module already handles adding the file to your project. Also unrelated, but if your config is TypeScript, use export default rather than module.exports =.
Activity
[-]split used css to separate css files after buxt build.[/-][+]split used css to separate css files after production build.[/+]ineshbose commentedon Oct 21, 2023
I thought that CSS was external to your head in Nuxt 3-rc.9 onwards and moved to inlining it in experimental. Do you mind sharing your configuration?
mnaviddoost commentedon Oct 22, 2023
yes. sure @ineshbose
this is my nuxt.config.ts
tailwind.config.ts
now used tailwind classes injected in head of html page. i want split it into separate files that i can see them in chrome network tab as separete *.css files
mnaviddoost commentedon Oct 22, 2023
@ineshbose
I noticed that if i set ssr: false in nuxt.config.ts, the css files split to separate files and everything is ok.
but i dont want set ssr to false.because my project is SEO based
ineshbose commentedon Oct 22, 2023
The CSS should be separate files. Read related #579, #531 (comment), and nuxt/framework#8666.
I hope
@/assets/css/main.scssisn't related to Tailwind because the module already handles adding the file to your project. Also unrelated, but if your config is TypeScript, useexport defaultrather thanmodule.exports =.ozgurozalp commentedon Oct 30, 2023
Same for me tailwind styles are in style tag, how can I import them with link tag
meruiden commentedon Jan 19, 2024
I managed to fix it using: