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 "bundles"}} #47

Closed
matthewp opened this issue Sep 4, 2015 · 6 comments
Closed

{{asset "bundles"}} #47

matthewp opened this issue Sep 4, 2015 · 6 comments

Comments

@matthewp
Copy link
Contributor

matthewp commented Sep 4, 2015

I don't know why we didn't think of this before @justinbmeyer but we could have a "bundles" asset type that would inline all of the bundles needed for a particular request, so you wouldn't need to wait for steal to progressively fetch them. For example:

<script src="/node_modules/steal/steal.production.js" main="pmo/index.stache!done-autorender"></script>

{{asset "bundles"}}

would render to something like:

<script src="/node_modules/steal/steal.production.js" main="pmo/index.stache!done-autorender"></script>

<script src="/bundles/pmo/index.js"></script>
<script src="/bundles/pmo/home.js"></script>
</script src="/bundles/pmo/home-and-search.js"></script>
<script>
  // Define these as empty to prevent steal from trying to re-import them
  System.set("bundles/pmo/index", {});
  System.set("bundles/pmo/home", {});
  System.set("bundles/pmo/home-and-search", {});
</script>
@matthewp
Copy link
Contributor Author

matthewp commented Sep 4, 2015

For this to work we need Steal to set window.define which it currently does not do.

@matthewp
Copy link
Contributor Author

matthewp commented Sep 4, 2015

An even crazier idea: inline the source code directly in script tags.

@justinbmeyer
Copy link
Contributor

Providing the dep tree would be an easier / safer version that would be only slightly slower.

Sent from my iPhone

On Sep 4, 2015, at 2:56 PM, Matthew Phillips [email protected] wrote:

An even crazier idea: inline the source code directly in script tags.


Reply to this email directly or view it on GitHub.

@matthewp
Copy link
Contributor Author

I don't know what would be unsafe about inserting the scripts, this is what steal does anyways, right? The hard part would be getting them in the correct order, so yeah I guess inserting the depCache would be an easier alternative. I'll give it a shot when I have some free time.

@justinbmeyer
Copy link
Contributor

Safer in terms of less error prone, not in terms of security. This is how the old steal worked. It's possible, but tricky.

@matthewp
Copy link
Contributor Author

The {{asset}} helper no longer exists, and this need is superseded by #211 and #212

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

No branches or pull requests

2 participants