umbraco 中的 ClientDependency 不包括我的包

ClientDependency in umbraco doesn't include my bundles

这里是我调用 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"));
    }
}

这里是我调用捆绑包的地方(我的 Master.cshtml 页面底部):

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

这是我得到的:

我的客户端依赖临时 xmp 文件的内容:

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

我授予所有人完全访问权限(在本地),文件与文件夹具有相同的安全性(assets/css、assets/js)

我有标准的 ClientDependency.config 文件。

我做错了什么?

我终于明白了。 Html.RequiresJsBundle("customjs1") 只是让当前页面依赖于 bundle,你仍然需要使用 Html.RenderJsHere 来输出脚本标签。

来源:https://github.com/Shazwazza/ClientDependency/issues/1

下面是我如何渲染这些包:

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