Packages API: ability to load certain JavaScript files before others #181

Closed
bminer opened this Issue Jun 12, 2012 · 10 comments

Comments

Projects
None yet
9 participants
Contributor

bminer commented Jun 12, 2012

For example, view templates should be loaded before custom application logic.

Not sure how this could be implemented...

This would also resolve hacks like these: https://github.com/meteor/meteor/blob/5d069169a98ff6b1131e2ab242509f60838a700f/app/lib/packages.js#L152-180

Contributor

TomWij commented Jun 12, 2012

Note that this is not only necessary for the packages but also for the files in Meteor itself, it would be much better if this happened automatically through some automated parsing mechanism than having to be done by each developer which might result in annoying situations (Dependency chain: X --> Y --> Z --> X)...

Contributor

zhangcheng commented Jun 18, 2012

Will bringing RequireJS solve this problem?

Contributor

avital commented Sep 19, 2012

I believe some people resort to alphabetical ordering of filenames to get the right results. This is definitely a problem.

avitall

I believe some people resort to alphabetical ordering of filenames to get the right results. This is definitely a problem.

I used to do this when i first try to include third party features on a meteor project.

Contributor

mpj commented Sep 20, 2012

@avital That is how I did it, yeah. It actually worked pretty well, but it's very hacky and doesn't allow for lazy loading stuff.

buguibu commented Nov 29, 2012

@mpj "lazy loading stuff" that's what i try for minify the web as much as possible, but maybe because i still dont understand how Meteor works.

I have tried to load a JS file with $.get("file.js"); but is received in the client as a Meteor page with all the packages.

Member

gschmidt commented Dec 4, 2012

This is now being worked on as part of the new package system interface (by giving developers explicit control over the ordering of files in their project, when they want it.)

Contributor

bminer commented Mar 8, 2013

@gschmidt - That's great news. Many people are having issues with this when switching to the Blade view engine. Their views get loaded after their application code, which causes statements like Template.foo.rendered to complain... since Template.foo has not yet been created.

Contributor

bminer commented May 3, 2013

@gschmidt - Any updates on this? It's been a while, and I wanted to check in.

bminer referenced this issue in bminer/node-blade May 3, 2013

Closed

Showing current user in Meteor #173

Owner

glasser commented Apr 18, 2014

The specific use case requested here was added in f36abc9

glasser closed this Apr 18, 2014

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