1

Here is where I call the BundleManager:

public class MyUmbracoApplication : UmbracoApplication
{ 
    protected override void OnApplicationStarted(object sender, System.EventArgs e)
    {
        //register custom routes
        RouteConfig.RegisterRoutes(RouteTable.Routes);

        CreateBundles();

        base.OnApplicationStarted(sender, e);
    }

    public static void CreateBundles()
    {
        BundleManager.CreateCssBundle("css",
            new CssFile("~/css/rte.css"));

        BundleManager.CreateJsBundle("js",
            new JavascriptFile("/assets/js/custom.js"));
    }
}

Here is where I call the bundles (bottom of the page of my Master.cshtml) :

 <div class="test">
        @{
            Html.RequiresJsBundle("js");
            Html.RequiresCssBundle("css");
         }
    </div>

Here is what I get:

enter image description here

The content of my clientdependency temp xmp file:

<?xml version="1.0" encoding="utf-8" standalone="yes"?><map />

I gave full access to Everyone (on local), the files have the same securities than the folder (assets/css, assets/js)

I have the standard ClientDependency.config file.

What did I do wrong ?

Giu
  • 1,832
  • 2
  • 16
  • 31

1 Answers1

1

I finally figured out. Html.RequiresJsBundle("customjs1") just makes the current page dependent on the bundle, you'd still need to use Html.RenderJsHere to output the script tag.

source: https://github.com/Shazwazza/ClientDependency/issues/1

Here is how I rendered the bundles:

Html.RequiresJsBundle("customjs1"); // at the top of the page, inside @{}

@Html.RenderJsHere() // where the js needs to be rendered - at the bottom of the page for me
Giu
  • 1,832
  • 2
  • 16
  • 31
  • hi @Giu can I have two loader js per page one on head and one on bottom because i have Two JS Bundle thanx Esmeraldi – Esmeraldi Bejolli Mar 09 '17 at 09:50
  • Hi Esmeraldi, it's the same logic, you just have to call 'Html.Requires..' 2 times (one for each bundle) and then call Html.RenderJsHere('bundle1') and Html.RenderJsHere('bundle2'). Look at line 267 https://github.com/Shazwazza/ClientDependency/blob/b5ba8cf6fbe476365b948888478e4389dbd0f710/ClientDependency.Mvc/HtmlHelperExtensions.cs – Giu Mar 09 '17 at 10:13