Loading order #57

Closed
richburdon opened this Issue Aug 9, 2015 · 5 comments

Projects

None yet

4 participants

@richburdon

This might be a more general systemjs feature/question: is it possible to ensure that CSS gets loaded before the main page loads?

I.e., to replace the need for hard coded package links in the header:

<link rel="stylesheet" href="/res/packages/github/twbs/bootstrap@3.3.5/css/bootstrap.css">

With something like this (which works, but loads asynchronously -- so you see the raw HTML for half a second before the CSS loads):

<script type="application/javascript">
  System.import('bootstrap/css/bootstrap.css!');
  System.import('app/test/js/bootstrap.js');
</script>
@guybedford
Member

We don't provide guarantees for CSS loading order, just like modules. Although the next major release will actually provide this feature as load execution order is set to be deterministic in the latest loader specification.

@areel areel referenced this issue in jspm/jspm-cli Dec 1, 2015
Closed

Bundle-sfx css ordering #1337

@dalgard
dalgard commented Jan 8, 2016

@guybedford: When you say 'major release' – are we talking about 1.0.0 of SystemJS? Do you have any idea when that will be?

I need to be able to depend on load order in order to override UI library features without relying on !important statements or inefficient ancestor selectors.

@guybedford
Member

@dalgard unfortunately that update won't be anytime soon, as it requires the whatwg loader spec to be stable first.

@guybedford guybedford closed this Aug 21, 2016
@dazinator

I am experiencing this problem..

Is there some javascript event / method of being notified once all dependencies have been loaded? Because I was thinking of perhaps hiding the entire page content, and then once all dependencies loaded, unhide the content. Does this sound workable?

@dazinator

Ok - it was as simple as:

  System.import("js/site").then(function(m) { $('.body').show(); });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment