在Bundle.config可以包括ScriptBundles? [英] Can the Bundle.config include ScriptBundles?

查看:121
本文介绍了在Bundle.config可以包括ScriptBundles?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能否在我的 Bundle.config 文件脚本,或者是只对风格包?

Can I include scripts in my Bundle.config file, or is it only for style bundles?

<?xml version="1.0" encoding="utf-8" ?>
<bundles version="1.0">
  <styleBundle path="~/Content/css">
    ...
  </styleBundle>
  <scriptBundle path="~/Scripts">

    Is this possible?

  </scriptBundle>
</bundles>

还有谁能提供一个链接到一个 Bundle.config 引用解释可能的标签和结构?我搜索,但所有我能想出是捆绑销售,而不是标记的 BundleConfig.cs code方式。我明白为什么 - 标记方式是老年人,甚至去precated。不过,我想学习的标记方式为常见的,我会与使用旧方法的遗留系统中工作。

Also can anyone provide a link to a Bundle.config reference that explains the possible tags and structure? I've searched but all I can come up with is the BundleConfig.cs code way of bundling rather than the markup. I realise why - the markup way is older and maybe even deprecated. But I would like to learn the markup way as its common I will be working with legacy systems that use the older method.

推荐答案

这就是所谓的捆绑清单。这是一个XML位于〜/ bundle.config 并加载到)文件BundleManifest.ReadBundleManifest(; 的Application_Start

This is called a "bundle manifest". This is an XML file located at ~/bundle.config and loaded through BundleManifest.ReadBundleManifest(); in your Application_Start.

有一个<一个href=\"https://aspnetoptimization.$c$cplex.com/SourceControl/latest#src/System.Web.Optimization/BundleManifestSchema.xsd\"相对=nofollow> XSD在codePLEX,命名BundleManifestSchema.xsd :

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="BundleConfig" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:complexType name="include">
    <xs:attribute name="path" type="xs:string" use="required" />
  </xs:complexType>

  <xs:complexType name="styleBundle">
    <xs:sequence>
      <xs:element name="include" type="include" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="path" type="xs:string" use="required" />
    <xs:attribute name="cdnPath" type="xs:string" use="optional" />
  </xs:complexType>

  <xs:complexType name="scriptBundle">
    <xs:sequence>
      <xs:element name="include" type="include" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="path" type="xs:string" use="required" />
    <xs:attribute name="cdnPath" type="xs:string" use="optional" />
    <xs:attribute name="cdnFallbackExpression" type="xs:string" use="optional" />
  </xs:complexType>

  <xs:element name="bundles">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element type="styleBundle" name="styleBundle" />
        <xs:element type="scriptBundle" name="scriptBundle" />
      </xs:choice>
      <xs:attribute name="version" type="xs:string" />
    </xs:complexType>
  </xs:element>

</xs:schema>

所以,是的, scriptBundle 是支持的。

这篇关于在Bundle.config可以包括ScriptBundles?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆