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

Moves <script> tags to end of <body> #6375

Merged
merged 1 commit into from
Mar 2, 2016

Conversation

zol
Copy link
Contributor

@zol zol commented Mar 1, 2016

Rather than include our bundle from , include it at the end of . This way, code can make use of the new dynamicHead feature to add loading html into the boilerplate. (as requested by #3860)

@martijnwalraven martijnwalraven added the in-development We are already working on it label Mar 1, 2016
@zol zol removed the in-development We are already working on it label Mar 1, 2016
@zol zol added this to the Release 1.3 milestone Mar 1, 2016
@mitar
Copy link
Contributor

mitar commented Mar 2, 2016

So cool!

@crapthings
Copy link

all scripts are after start of the body tag, not the end.

what is the different between in head?

<script type="text/javascript">**meteor_runtime_config** = JSON.parse(decodeURIComponent("%7B%22meteorRelease%22%3A%22METEOR%401.3.1%22%2C%22meteorEnv%22%3A%7B%22NODE_ENV%22%3A%22development%22%2C%22TEST_METADATA%22%3A%22%7B%7D%22%7D%2C%22PUBLIC_SETTINGS%22%3A%7B%7D%2C%22ROOT_URL%22%3A%22http%3A%2F%2Fcubes.legal%22%2C%22ROOT_URL_PATH_PREFIX%22%3A%22%22%2C%22appId%22%3A%22432alqykmnfz1yh9mh1%22%2C%22autoupdateVersion%22%3A%22a9485d025cf3aa02e94156eb731c3dadc936625c%22%2C%22autoupdateVersionRefreshable%22%3A%222d9889120823a66812793b07955a3c1de86945dd%22%2C%22autoupdateVersionCordova%22%3A%22none%22%7D"));</script>
<script type="text/javascript" src="/packages/underscore.js?hash=8de51f9d86e95ae2ffee15a8db324a1decccba3e"></script>
<script type="text/javascript" src="/packages/meteor.js?hash=199010c1afa99e8bd5ece688951432123b502723"></script>
<script type="text/javascript" src="/packages/meteor-base.js?hash=78d760bd25caaa0aaaa51b630ff14fdbfddf0a80"></script>
<script type="text/javascript" src="/packages/mobile-experience.js?hash=228175c74a6bdd2cc7d213d791ad7633cde48eb6"></script>
<script type="text/javascript" src="/packages/base64.js?hash=b81b0d2b7b33328b3b89ee0f5a255a9ccdc7becb"></script>
<script type="text/javascript" src="/packages/ejson.js?hash=06477dace2029b30779531d0eee8ee0c400e4525"></script>
<script type="text/javascript" src="/packages/modules-runtime.js?hash=939c79dfda40f1a849312e224b12b3aa11452782"></script>
<script type="text/javascript" src="/packages/modules.js?hash=19396fa13176a382627e98e8a13ff6aa821a2d66"></script>
<script type="text/javascript" src="/packages/jquery.js?hash=649d9f4d10ffd1b725db74dbd268ff935227a999"></script>
<script type="text/javascript" src="/packages/check.js?hash=b15bbb57fb6b392447aae5d6adc7dd1183d0f2a3"></script>
<script type="text/javascript" src="/packages/babel-compiler.js?hash=e1688ae6cf3e302b7737b0ce56fa790cc0a9be03"></script>
<script type="text/javascript" src="/packages/ecmascript.js?hash=66523b499a44a9bde66a5c90da84c2f620fa9038"></script>
<script type="text/javascript" src="/packages/id-map.js?hash=c7ee77be99a8b1f8ec984e2c122864f9604525d5"></script>
<script type="text/javascript" src="/packages/ordered-dict.js?hash=0389f6fd93358207ec24f56a66b65cea226646a1"></script>
<script type="text/javascript" src="/packages/tracker.js?hash=b267c37effdf4af331d16fc647c0370c2eaff44d"></script>
<script type="text/javascript" src="/packages/es5-shim.js?hash=6c690fb6264db23904871b6b2accd6fee75a2e67"></script>
<script type="text/javascript" src="/packages/promise.js?hash=76f9fa05244092de9aa9eb2b32e81d4c7cb48166"></script>
<script type="text/javascript" src="/packages/ecmascript-runtime.js?hash=4e4ed2f265b0ab04be3c225afadff0a6ad1ad00b"></script>
<script type="text/javascript" src="/packages/babel-runtime.js?hash=25e64a1d62222dd3d1646486c94e81a3639043f5"></script>
<script type="text/javascript" src="/packages/random.js?hash=94fe15f9966e8181e2b6e610bf7a2c58c40a4ce7"></script>
<script type="text/javascript" src="/packages/mongo-id.js?hash=8810275f539ed7bbad9202ce7639600ff8ee26cf"></script>
<script type="text/javascript" src="/packages/diff-sequence.js?hash=727c5f356b359104f0b5586eab1b7866bce68589"></script>
<script type="text/javascript" src="/packages/geojson-utils.js?hash=15d58e409f3e68223a6c7bf4b3a5dbb41c0eb9e2"></script>
<script type="text/javascript" src="/packages/minimongo.js?hash=a0d533dedc4ce27ae70b6a13ae3b8227d2d21159"></script>
<script type="text/javascript" src="/packages/retry.js?hash=134b8c4e4edb2b4a96ea22178dfdc4702226293a"></script>
<script type="text/javascript" src="/packages/ddp-common.js?hash=96850536f446242cf0c8811bc434af3346d26bf1"></script>
<script type="text/javascript" src="/packages/reload.js?hash=1917116c9d89d442051faef6edf03691d5fd10fe"></script>
<script type="text/javascript" src="/packages/ddp-client.js?hash=4b5dd6c64affcb1f152409ce9ede08973e06a2b7"></script>
<script type="text/javascript" src="/packages/ddp.js?hash=752b775e282ca59c21ca09b9cc61f5fffb9ea2a1"></script>
<script type="text/javascript" src="/packages/ddp-server.js?hash=f22a106538ade54bd1190c4d309f2f94bdd3ec9b"></script>
<script type="text/javascript" src="/packages/allow-deny.js?hash=28b7b02fffd8490f81f75fa9580e532e61473c0a"></script>
<script type="text/javascript" src="/packages/insecure.js?hash=5679de9a1eaf70c1c18f8c3bf9493ebe2e4caa33"></script>
<script type="text/javascript" src="/packages/mongo.js?hash=bc4cc4faf274ce28cefc812067aa65c0d4025ed4"></script>
<script type="text/javascript" src="/packages/blaze-html-templates.js?hash=789c063ee96f7c7159040c8b3bf86cbc4ede975f"></script>
<script type="text/javascript" src="/packages/reactive-var.js?hash=6d3dc00fae3831478105b808e0b227f7047be039"></script>
<script type="text/javascript" src="/packages/standard-minifier-css.js?hash=28195a94bf7be7891ced328ed580307f7ac6ed54"></script>
<script type="text/javascript" src="/packages/standard-minifier-js.js?hash=555d6f310158f363207df43e0353de4a4883d7af"></script>
<script type="text/javascript" src="/packages/autopublish.js?hash=bc72b03fb56c2a80ef076107d3c27287cbc7ca08"></script>
<script type="text/javascript" src="/packages/webapp.js?hash=7431a11f1c671b350504fe7192b94219e5200359"></script>
<script type="text/javascript" src="/packages/livedata.js?hash=e7fb2e783bc81b00b914c2e27966b7b6d3d081b6"></script>
<script type="text/javascript" src="/packages/hot-code-push.js?hash=9121bd39124b5010787be320ca559344b6691712"></script>
<script type="text/javascript" src="/packages/deps.js?hash=af038305759a654448f8031d60f379835ae67a8c"></script>
<script type="text/javascript" src="/packages/htmljs.js?hash=34dcd0302685e85d306c265951ba5e49f54001b2"></script>
<script type="text/javascript" src="/packages/observe-sequence.js?hash=b4e2d695a6de0090d16421b24913b4cab1984098"></script>
<script type="text/javascript" src="/packages/blaze.js?hash=38069f4f7cfbd8898160bc97d37dd847cd5985fe"></script>
<script type="text/javascript" src="/packages/spacebars.js?hash=6b2a9ade7533b27d695f0281f10c438e40b8e6f8"></script>
<script type="text/javascript" src="/packages/templating.js?hash=045a1b34c3ed1159e0c8dd0659d0b95d8ba5a6d2"></script>
<script type="text/javascript" src="/packages/launch-screen.js?hash=56bda4b972e8035450feba7f866a060872c46fbc"></script>
<script type="text/javascript" src="/packages/ui.js?hash=d0665bbf032532e2284f8843b30500babb10dd4d"></script>
<script type="text/javascript" src="/packages/autoupdate.js?hash=028c641918eb50a83f0f93187f6373bc617e73f7"></script>
<script type="text/javascript" src="/packages/global-imports.js?hash=87b351cd729a2fb016375419601a2d92f750baa2"></script>
<script type="text/javascript" src="/app/app.js?hash=4e33c33ac762b1353f4499fb3dc2e8b040ae89d7"></script>




<h1>Welcome to Meteor!</h1>

<button>Click Me</button>
<p>You've pressed the button 0 times.</p>
<h2>Learn Meteor!</h2>
<ul>
  <li><a href="https://www.meteor.com/try">Do the Tutorial</a></li>
  <li><a href="http://guide.meteor.com">Follow the Guide</a></li>
  <li><a href="https://docs.meteor.com">Read the Docs</a></li>
  <li><a href="https://forums.meteor.com">Discussions</a></li>
</ul></body>

@abhiaiyer91
Copy link

Hey im late to the party on this, but we had some scripts in head. What do you suggest we do for jquery plugins loaded in async in head...now they dont have jquery refs

@mitar
Copy link
Contributor

mitar commented Jun 16, 2016

What do you mean? You should always wrap use of your jQuery modules inside jQuery.ready (or Meteor.startup) and this is it? Then it does not matter when your code is loaded.

@mitar
Copy link
Contributor

mitar commented Jun 16, 2016

Or are you saying that because now loading of jQuery itself has been put at the end, if you just add scripts to the head, jQuery itself is not yet loaded at that point? Maybe add those <script> tags with async attribute then? Or are you saying that that does not work?

@zol
Copy link
Contributor Author

zol commented Jun 16, 2016

Hey @abhiaiyer91 . I don't quite understand the problem. Could you post a brief, illustrative code sample?

Edit: Feel free to disregard this question if we've already solved the issue for you via the Develop Subscription.

@abhiaiyer91
Copy link

abhiaiyer91 commented Jun 16, 2016

@mitar @zol Mitar, sorry for being vague. Yes exactly what you said, we had scripts in head loading async already. Now jquery has moved to the end, so we got some reference errors.

What we ended up doing was adding defer to our script tags. This works for us because we don't support IE10 and lower, but for some users who are, this change would change their app's assumptions about jquery.

We don't want to have these 3rd party libs in our bundle, as it is big already...

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

Successfully merging this pull request may close these issues.

None yet

5 participants