N
N
Nikita Egorov2018-06-19 16:00:38
Layout
Nikita Egorov, 2018-06-19 16:00:38

What is the best way to load vue styles?

Hello!
I decided to learn lazy loading, and I don't know how to load css styles correctly.
There are two options:

  1. Load styles separately (in parallel with n.bundle.js)
  2. Load styles in n.bundle.js

There is no difference in download speed.
Tested in disable cache and slow 3g
5b28fc4d431a5589901833.png
In one of the components (0.bundle.js) in the style tag, I inserted a css library weighing 270 kb, for clarity.
In the first case, 0.bundle.js is loaded earlier, only then 0.style.css is loaded. But at the same time, the inscription, "welcome to page 3" appears only after loading 0.style.css (why?), although js has already been compiled.
In the second case we have 0.bundle.js along with css inside.
So, what is the best way to load css and how do you do it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question