order of styles and scripts

Hi again

In my experience I have found that "order of styles and scripts" affects page load speed
and so I try to code external CSS before external JavaScript.
Other JS (not required in the head) goes before closing body tag.

Looking at optimization in Chrome Developer Tools I get,

"Optimize the order of styles and scripts (7)

The following external CSS files were included after an external JavaScript file in the document head. To ensure CSS files are downloaded in parallel, always include external CSS before external JavaScript."






Each of these blocks includes a view.css though i'm not sure how it is called, but to me it appears to be an issue.

Do I need to update these blocks to "register" the css, js as in this link.


I have noticed a view.css in other blocks too so if 'registering' is the right way to include css, js I will have do each block I use.

Any comments, feedback on this issue, appreciated.

low tech

Note there was also this in Chrome

2 inline script blocks were found in the head between an external CSS file and another resource. To allow parallel downloading, move the inline script before the external CSS file, or after the next resource.

But I'll look at that after dealing with the registering question

View Replies: View Best Answer
MrKDilkington replied on at Permalink Best Answer Reply
Hi lowtech,

I don't believe the order of styles and scripts affects page load speed as much as it affects the "perceived" page load speed.

To reduce server requests, concrete5 has this feature:
"CSS and JavaScript Cache
This setting will attempt to combine and minify JS assets and CSS assets (respectively) on the fly to cut down on HTTP requests and speed up sites."

I believe the recommendation to include CSS before JavaScript is to avoid render blocking.

In general, you will either run JavaScript in the head async or in the body. There is an exception to this in concrete5, jQuery will be loaded in the head and not async. This is done because so many blocks and themes require jQuery to work. Including it async or in the body will break many blocks and themes.

For what you are describing, I don't think it is a significant issue that will impact performance in a noticeable way.

I definitely recommend reading these two articles:

If you enjoy these articles, then I encourage you to read this book:

I have personally made non-CMS based sites that used these techniques. Implementing them is not easy or straightforward and the benefit is minimal for smaller well designed sites. Where it really pays off is in large sites with a lot of CSS and you are trying to find any way to shave time off of a page load.

Using these techniques in a CMS is far more complicated.
lowtech replied on at Permalink Reply

cool stuff

I guess my thinking is still old school ;)

Once again, if I don't need to concern about it that's ok by me, but i'm always looking to make a page appear onscreen as quick as possible.

So will definitely read up on those links you provided.

Thanks, appreciated