{"action":"created","issue":{"url":"https://api.github.com/repos/babel/babel.github.io/issues/194","labels_url":"https://api.github.com/repos/babel/babel.github.io/issues/194/labels{/name}","comments_url":"https://api.github.com/repos/babel/babel.github.io/issues/194/comments","events_url":"https://api.github.com/repos/babel/babel.github.io/issues/194/events","html_url":"https://github.com/babel/babel.github.io/pull/194","id":63456433,"number":194,"title":"Move script files to end of body. Closes #19","user":{"login":"peterblazejewicz","id":14539,"avatar_url":"https://avatars.githubusercontent.com/u/14539?v=3","gravatar_id":"","url":"https://api.github.com/users/peterblazejewicz","html_url":"https://github.com/peterblazejewicz","followers_url":"https://api.github.com/users/peterblazejewicz/followers","following_url":"https://api.github.com/users/peterblazejewicz/following{/other_user}","gists_url":"https://api.github.com/users/peterblazejewicz/gists{/gist_id}","starred_url":"https://api.github.com/users/peterblazejewicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterblazejewicz/subscriptions","organizations_url":"https://api.github.com/users/peterblazejewicz/orgs","repos_url":"https://api.github.com/users/peterblazejewicz/repos","events_url":"https://api.github.com/users/peterblazejewicz/events{/privacy}","received_events_url":"https://api.github.com/users/peterblazejewicz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-03-21T21:28:25Z","updated_at":"2015-03-21T21:59:50Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/babel/babel.github.io/pulls/194","html_url":"https://github.com/babel/babel.github.io/pull/194","diff_url":"https://github.com/babel/babel.github.io/pull/194.diff","patch_url":"https://github.com/babel/babel.github.io/pull/194.patch"},"body":"This PR literally moves all scripts to the bottom of the page - because #perfmatters.\r\nThe idea of these changes is to let author(s) of the page to easily add new client side code by modifying either page template (layout) file front metter declaration(s) or by modifying page front metter declaration(s).\r\n\r\nFor example - the web site is using Bootstrap framework cross-site. So the idea of solution in this PR is to declare that Bootstrap is to be used everywhere on the layout level:\r\n```liquid\r\n---\r\nlayout_external_scripts:\r\n - //cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js\r\n - //cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js\r\n - //cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js\r\n---\r\n```\r\n\r\nand then simply use that information to write script tag into page body:\r\n```liquid\r\n{% if page.layout_external_scripts %}\r\n  {% for script_path in page.layout_external_scripts %}\r\n  <script src=\"{{ script_path }}\"></script>\r\n  {% endfor %}\r\n{% endif %}\r\n```\r\n\r\nThe local scripts are using cache busting solution.\r\n\r\nAs there could be 4 types of scripts (as the time of writing) within web site, there are 4 different lists declared:\r\n- external on the layout level\r\n- external on the page level\r\n- local on the layout level\r\n- local on the page level\r\n\r\nThe scripts are rendered later in the above list order (if they are declared and available in the `page` variable ofc).\r\n\r\nThis PR commits:\r\n- remove render-blocking scripts from page haed section\r\n- move embedded scripts from markup to JavaScript file\r\n- prepare site-wide solution based on front metter declared variables\r\n- specify layout related external and web site scripts in templates\r\n- specify page specific external and web site scripts in templates\r\nAll scripts used on the website are now declared using list in front\r\nmetter sections. This allows to build up the correct order of script inclusion\r\nin the given page and allows the future optimization if script minifying\r\nis to be introduced.\r\n\r\n![20150321221418](https://cloud.githubusercontent.com/assets/14539/6766893/1e9572a0-d019-11e4-80d4-267696ab7faf.jpg)\r\n\r\nI've tried to test everything, comparing fetched scripts with current live version (and checking for scripts errors), but I'd ask someone to verify this PR as well.\r\n\r\n@thejameskyle\r\nThis should improve overall page rendering speed and responsiveness.\r\n\r\nThanks!\r\n"},"comment":{"url":"https://api.github.com/repos/babel/babel.github.io/issues/comments/84459740","html_url":"https://github.com/babel/babel.github.io/pull/194#issuecomment-84459740","issue_url":"https://api.github.com/repos/babel/babel.github.io/issues/194","id":84459740,"user":{"login":"peterblazejewicz","id":14539,"avatar_url":"https://avatars.githubusercontent.com/u/14539?v=3","gravatar_id":"","url":"https://api.github.com/users/peterblazejewicz","html_url":"https://github.com/peterblazejewicz","followers_url":"https://api.github.com/users/peterblazejewicz/followers","following_url":"https://api.github.com/users/peterblazejewicz/following{/other_user}","gists_url":"https://api.github.com/users/peterblazejewicz/gists{/gist_id}","starred_url":"https://api.github.com/users/peterblazejewicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterblazejewicz/subscriptions","organizations_url":"https://api.github.com/users/peterblazejewicz/orgs","repos_url":"https://api.github.com/users/peterblazejewicz/repos","events_url":"https://api.github.com/users/peterblazejewicz/events{/privacy}","received_events_url":"https://api.github.com/users/peterblazejewicz/received_events","type":"User","site_admin":false},"created_at":"2015-03-21T21:59:50Z","updated_at":"2015-03-21T21:59:50Z","body":"> Can you combine the social scripts into one file?\r\n\r\nUpdate, combined - not squashed to see as separate commit as of now"}}