Closed thany closed 8 years ago
Use Webpack + vue-loader if you want CSS extraction.
Not just vue-loader, you need a whole lot more than that. But still what did you mean by "if you want"? I mean, who seriously wants to bloat their DOM with CSS, and injected by javascript to make it worse?
@thany it works pretty well in practice for small and medium sized projects. It only becomes problematic when you have hundreds of different components, in which case you should be using Webpack + vue-loader instead, which offers CSS extraction, dedupe, minification etc. Since you are using vue-cli already, it's really just switching to a different template where things are already set up for you. Or, if you are not lazy, you can contribute to add CSS extraction support to vueify.
I did exactly this:
And then opened http://localhost:8080. Empty page (well, only a heading, that is), which seems fine, since it's supposed to be an empty project. But here the thing: it doesn't output any css. It manages to inject css inline in the DOM, but it doesn't create a proper css file and reference to that in the html. What it should do: output a html file with a new
<link>
tag in it, and output a css file as well with all compiled css.Injecting css like this is absolutely horrible for performance.