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

Asset Ordering #1417

Closed
RobertLowe opened this issue Sep 11, 2013 · 7 comments
Closed

Asset Ordering #1417

RobertLowe opened this issue Sep 11, 2013 · 7 comments

Comments

@RobertLowe
Copy link
Contributor

@timhaines @n1mmy

This is an edge case, but since the APIs are under going changes I thought I should call attention to it.

The bundle API doesn't allow a plugin developer to control the order of asset compilation, or at least, priority.

This is important because, with a template plugin (jade-handlebars) code you need to load the templates before user code (coffeescript).

Without the ability to direct the underlying system, the coffeescript is loaded first, before the template is defined via js.

Uncaught ReferenceError: Template is not defined

I was able to work around this by using the alphabetical ordering of files/directories.

Any thoughts on how I could fix this, or related information?

@timhaines
Copy link
Contributor

@RobertLowe Hey Robert, sorry, it's not an error I'm familiar with. Someone on the Meteor Team will have a better idea.

@glasser
Copy link
Contributor

glasser commented Sep 12, 2013

Yeah, this only works with Handlebars because of this "huge hack" https://github.com/meteor/meteor/blob/devel/tools/files.js#L42 which forces html files to come first in a file list. This doesn't work when you have a non-".html" template language. We need to figure this out eventually. For now, yeah, you can use alphabetical ordering (or put your template files in a subdirectory named, confusingly, lib).

@RobertLowe
Copy link
Contributor Author

@glasser Thanks, for pointing me to that. I'd love to see a template engine adapter.

@dweldon
Copy link

dweldon commented Apr 3, 2014

This is obviously an issue for mquandalle's jade package as well.

@RobertLowe
Copy link
Contributor Author

@dweldon indeed it's an issue for jade or other template engines, there is a workaround

This is also an area where Meteor might be rather opinionated. I feel like manifest or a dependancy chain should be the solution, but those might go against the grain of the simplicity the current rules offer.

@n1mmy
Copy link
Contributor

n1mmy commented Apr 3, 2014

@glasser just converted the "huge hack" to a "moderately sized hack" and added an option to mark files as templates. See f36abc9.

@Slava
Copy link
Contributor

Slava commented Apr 3, 2014

Also see meteor-jade's commit: mquandalle/meteor-jade@91b6464

@glasser glasser closed this as completed Apr 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants