Currently, toolbar assets are loading after those of contextual module and other contributed modules.

Screenshot of the Chrome Developer Tools open on a standard Drupal 8 site. The toolbar CSS assets are loaded after the contextual module and layout module assets.

Toolbar module assets should be loaded before any other modules so that core and contributed modules can override the CSS styles and JS functions it provides by default.

CommentFileSizeAuthor
toolbar-assets-load-order.png66.01 KBjessebeach

Comments

jessebeach’s picture

Issue tags: +toolbar-followup

Adding tag toolbar-followup

oresh’s picture

We can group the important CSS into another group ( 75 for ex. )
But still the browser will show you nothing, until all the css from header is loaded.
If the aggregation will work as it should - you'll get just one file - which is fine.

Also we can try and test image prefetch. ex:
It should be supported by IE9+, Chrome FF and Opera. And it doesn't break anything for browsers that don't support prefetching. If we add this line before the css - it forces browser to start downloading this image even until the css is being processed. So as soon as it reaches the line in css for sprite background - it should be already loaded.

I haven't found an issue for that yet, have no idea if anyone tried doing prefetch for css/images. If you do - please provide a link here, thanks!

wim leers’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

The only reason this happens is because Drupal 8 still uses the weight-based method of determining the asset loading order primarily. If it'd use dependency information only, this problem would go away.

Toolbar module assets should be loaded before any other modules so that core and contributed modules can override the CSS styles and JS functions it provides by default.

All our assets are in asset libraries now. Any contrib module or theme can override the CSS and JS by depending on the library they want to override, because that means the CSS/JS that is depended upon is loaded first, and hence it's then available for overriding :)