Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm experimenting with using Clientdependencies and sections, to only load the required javascript on the templatepage.
So on the Masterpage I have this:
@{ Html.RequiresJs("~/scripts/navigation.js"); Html.RequiresJs("~/scripts/slick.js"); @RenderSection("ExtraScripts", false); Html.RequiresJs("~/scripts/external/readmore.min.js"); } @Html.RenderJsHere()
On the templatepage I have this:
@inherits Umbraco.Web.Mvc.UmbracoViewPage @using ClientDependency.Core.Mvc; @section ExtraScripts { @Html.RequiresJs("~/scripts/filters.js"); }
The scripts is being rendered correctly in HTML, but theres a little addition to it.. When I remove the @section, it's gone.. Any idea how to get rid of it ?
System.Web.Mvc.HtmlHelper`1[Umbraco.Core.Models.PublishedContent.IPublishedContent]; <script src="/scripts/navigation.js?cdv=208785142" type="text/javascript"></script> <script src="/scripts/slick.js?cdv=208785142" type="text/javascript"></script> <script src="/scripts/filters.js?cdv=208785142" type="text/javascript"></script>
Hi
the thing i do all the time is the put the @ on the front of the Html.Requires when it isn't needed
@
Html.Requires
so just check - you don't have a @Html.RequiresJs('...') when it should be Html.RequiresJs('...');
@Html.RequiresJs('...')
Html.RequiresJs('...');
Thanks for the reply, I've tested this though.
When I am not using the @ when calling the filters, it only prints the value.
BUT, when I tried the following. It works, without any extra fluff ;-) Just put them in a code bracket!
@section ExtraScripts { @{ Html.RequiresJs("~/scripts/filters.js"); } }
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Clientdependency & sections
I'm experimenting with using Clientdependencies and sections, to only load the required javascript on the templatepage.
So on the Masterpage I have this:
On the templatepage I have this:
The scripts is being rendered correctly in HTML, but theres a little addition to it.. When I remove the @section, it's gone.. Any idea how to get rid of it ?
Hi
the thing i do all the time is the put the
@
on the front of theHtml.Requires
when it isn't neededso just check - you don't have a
@Html.RequiresJs('...')
when it should beHtml.RequiresJs('...');
Thanks for the reply, I've tested this though.
When I am not using the @ when calling the filters, it only prints the value.
BUT, when I tried the following. It works, without any extra fluff ;-) Just put them in a code bracket!
is working on a reply...