Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading order #57

Closed
richburdon opened this issue Aug 9, 2015 · 8 comments
Closed

Loading order #57

richburdon opened this issue Aug 9, 2015 · 8 comments

Comments

@richburdon
Copy link

@richburdon richburdon commented Aug 9, 2015

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
Copy link
Member

@guybedford guybedford commented Aug 24, 2015

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.

@dalgard
Copy link

@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
Copy link
Member

@guybedford guybedford commented Jan 9, 2016

@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
Copy link

@dazinator dazinator commented Nov 6, 2016

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
Copy link

@dazinator dazinator commented Nov 6, 2016

Ok - it was as simple as:

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

@djflex68
Copy link

@djflex68 djflex68 commented Mar 16, 2017

Any updates on this ?

@dazinator
Copy link

@dazinator dazinator commented Mar 16, 2017

@djflex68 - does System.import("your css").then(function(m) { $('.body').show(); }); not work for you - in combination with the css loader plugin? (with body hidden by default)

@djflex68
Copy link

@djflex68 djflex68 commented Mar 16, 2017

Unfortunately not in my case. I'm trying to load all CSS files of my application using import directive in a single .ts file. Ordering matters because of CSS selectors precedence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.