ASP.NET Bundle包括具有自定义html属性的资源

时间:2022-11-30 02:02:04

If I want to include a JS script like:

如果我想包含一个JS脚本,如:

<script src="../ClientTestFramework/Blanket/blanket.js" data-cover-adapter="../ClientTestFramework/Blanket/jasmine-blanket.js">

NB: with the extra html attribute

注意:使用额外的html属性

How can I do this with a ASP.NET Bundle?

如何使用ASP.NET Bundle执行此操作?

1 个解决方案

#1


1  

From the bundling tutorial:

从捆绑教程:

You can use the Url method to generate the URL to the asset without the markup needed to reference the asset.

您可以使用Url方法生成资产的URL,而无需引用资产所需的标记。

Adapted to your code:

适应您的代码:

<script src="@Scripts.Url("~/ClientTestFramework/Blanket/blanket.js")" data-cover-adapter="../ClientTestFramework/Blanket/jasmine-blanket.js">

#1


1  

From the bundling tutorial:

从捆绑教程:

You can use the Url method to generate the URL to the asset without the markup needed to reference the asset.

您可以使用Url方法生成资产的URL,而无需引用资产所需的标记。

Adapted to your code:

适应您的代码:

<script src="@Scripts.Url("~/ClientTestFramework/Blanket/blanket.js")" data-cover-adapter="../ClientTestFramework/Blanket/jasmine-blanket.js">