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

Allow first server response (which is a "normal" HTML response, not a SPF JSON response) to return CSS & JS aggregates #425

Open
wimleers opened this issue Oct 3, 2016 · 1 comment

Comments

@wimleers
Copy link

wimleers commented Oct 3, 2016

This would allow for better front-end performance. The first response (HTML) would then include aggregates. SPF responses would not include aggregates. Fewer requests for the first page load.

Necessary for this to work: ability of the name attribute to accept multiple values.

Example

Today, if the first page needs 3 JS files, and the second page needs 2 (of which one already exists on the first), that means 3 requests on the first page, 1 on the second. Wouldn't it be much better if those 3 requests (really, N requests) could be 1 request?

In other words, this would allow:

frontpage.html

<head><title>Frontpage</title></head>
<script name="a.js b.js c.js" src="aggregate.js</script>
secondpage.spf.json

{
  title: 'secondpage',
  body: {
    some_id: '<p>Hello world!</p><script name="b.js" src="b.js</script><script name="d.js" src="d.js</script>'
  }
}

Rather than requiring:

frontpage.html

<head><title>Frontpage</title></head>
<script name="a.js" src="a.js</script>
<script name="b.js" src="b.js</script>
<script name="c.js" src="c.js</script>

Existing logic

Test coverage should be added at https://github.com/youtube/spfjs/blob/cf4b0f499f174052003bce1a86ccb388a54cdbe1/src/client/nav/response_test.js — which also happens to show that this is not supported today.

@RoneyThomas
Copy link

Have you looked into webpack??? It can bundle all your JS dependencies???

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

2 participants