Place thescript
tag at the bottom of the page. Placing script tags at the end of the page improves app load time because the HTML loading is not blocked by loading of theangular.js
script.
<!DOCTYPE html>
<html lang="en" ng-app="app">
<head>
<base href="/">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width" initial-scale="1.0">
<link rel="stylesheet" href="/css/app.css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed" rel="stylesheet" type="text/css">
<!--if lte IE 7 script(src='http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js')-->
<!--if lte IE 8 script(src='//html5shiv.googlecode.com/svn/trunk/html5.js')-->
</head>
<body>
<div ng-controller="AppCtrl as app" class="app">
<div id="scrollcontainer" class="app-scroll-container">
<div ng-include="'/partials/menu.html'"></div>
<div ui-view></div>
<div ng-include="'/partials/footer.html'"></div>
</div>
</div>
<script src="/js/vendor.js"></script>
<script src="/js/partials.js"></script>
<script src="/js/app.js"></script>
</body>
</html>
Hi Tomw,
You can use the defer attribute on your script tags. But then again, your app is not showing anything to the user, until angular kicks in (and is largely done). You should show something to the user, even if everything else on your page fails to load.
adding this right below the body tag will help with your pagespeed:
<div ng-if="false">
<h1>Loading the application, please hold on</h1>
<div class='aCssSpinner'</div>
</div>
There are some more things that can be done, but this should put you on the right track.
Regards
Sander
/*************** IMPORT STYLES ***************/
//Twitter Bootstrap
@import 'bootstrap';
//Font Awesome Icons
@import '../../bower_components/font-awesome-sass/assets/stylesheets/font-awesome';
//Bourbon
@import '../../bower_components/bourbon/app/assets/stylesheets/bourbon';
//Defined Variables
@import 'vars';
//Defined Animations
@import 'animations';
And then in my 'bootstrap' file, I import only the necessary modules:
// Core variables and mixins
@import "../../bower_components/bootstrap-sass/assets/stylesheets/bootstrap/variables";
@import "../../bower_components/bootstrap-sass/assets/stylesheets/bootstrap/mixins";
// Reset and dependencies
@import "../../bower_components/bootstrap-sass/assets/stylesheets/bootstrap/normalize";
//@import "../../bower_components/bootstrap-sass/assets/stylesheets/bootstrap/print";
//@import "../../bower_components/bootstrap-sass/assets/stylesheets/bootstrap/glyphicons";
// Core CSS
@import "../../bower_components/bootstrap-sass/assets/stylesheets/bootstrap/scaffolding";
@import "../../bower_components/bootstrap-sass/assets/stylesheets/bootstrap/type";
//@import "../../bower_components/bootstrap-sass/assets/stylesheets/bootstrap/code";
@import "../../bower_components/bootstrap-sass/assets/stylesheets/bootstrap/grid";
@import "../../bower_components/bootstrap-sass/assets/stylesheets/bootstrap/tables";