In our existing web application we have done it at the starting of .cshtml
page:
@using Carwale.UI.PresentationLogic;
@model Carwale.Entity.ViewModels.HomeModel
@{
ViewBag.CustomJS = "~/Views/StaticPartials/HomeScripts.cshtml";
ViewBag.CustomCSS = "~/Views/StaticPartials/HomeCss.cshtml";
}
And in our "~/Views/StaticPartials/HomeScripts.cshtml"
, we have:
@model Company.Entity.ViewModels.HomeModel
<script>var landingPage = true;</script>
<script type="text/javascript" src="@(!string.IsNullOrWhiteSpace(ViewBag.staticUrl) ? "http://st.com" + ViewBag.stagingPath : "")/js/home.js?201605021628098010"></script>
I am getting render blocking javascript
suggestion from various performance website.
Can I improve this somehow?
I read that this should be in some javascript
section on the bottom of the page to improve the page load time.