Static GitHub Issues

[3074] How to extract each page style file into an independent file

prev: Compling time is negative
next: Google crawler parses empty DOM with SSR

Hi, all

Nuxt.js support extract all the common css in a file.

build: {
    extractCSS: {
      allChunks: true
    }
}

My config is above, and I am facing style conflict and coverage issues.

Because my css is mostly import like this

<style src="@/assets/css/reset.css">
</style>
<style src="@/assets/css/common.css">
</style>

If I set allChunks to false, all the css is injected in the ssr html page, which cause content-size too big.

So I am looking for a way to extract each page style file into an independent file, every page will link an independent css file. This could solve the questions of style conflict and ssr html content-size too big.

Thanks for help.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2661">#c2661</a>)</em></sub></div>