我可以将脚本包含在我的Bundle.config
文件,还是仅适用于样式包?
<?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
捆绑的代码方式而不是标记。我明白为什么 - 标记方式比较旧,甚至可能已被弃用。但我想学习标记方式,因为它很常见,我将使用使用旧方法的遗留系统。
这称为“捆绑清单”。这是一个 XML 文件,位于~/bundle.config
并加载通过BundleManifest.ReadBundleManifest();
在你的Application_Start
.
有一个CodePlex 中的 XSD,名为 BundleManifestSchema.xsd https://aspnetoptimization.codeplex.com/SourceControl/latest#src/System.Web.Optimization/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>
So yes, scriptBundle
是支持的。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)