Does @import in CSS result in additional http requests?

前端 未结 6 1663
北海茫月
北海茫月 2020-12-19 00:09

I have an ecommerce site that has about 8 CSS files linked from the header - resulting in 8 separate http requests to the server. I consolidated all the CSS files into 1 big

6条回答
  •  無奈伤痛
    2020-12-19 00:20

    Yes, a separate request is issued for each @import statement.

    You can check this with a quick test; write a fragment of HTML, including a CSS file which imports a second CSS file. Viewing the results in something like Firebug's network panel shows two separate requests for each CSS file. That's the test I used to confirm this answer.

提交回复
热议问题