Can Bundle.config include ScriptBundles?
Can I include scripts in my file Bundle.config
or is it just for style packs?
<?xml version="1.0" encoding="utf-8" ?>
<bundles version="1.0">
<styleBundle path="~/Content/css">
...
</styleBundle>
<scriptBundle path="~/Scripts">
Is this possible?
</scriptBundle>
</bundles>
Also can anyone provide a link to link Bundle.config
that explains the possible tags and structure? I've searched, but all I can think of is BundleConfig.cs
bundling code , not markup. I understand why - the markup method is older and possibly even outdated. But I would like to learn the markup way as its general I will be working with legacy systems that use the old method.
source to share
This is called the "bundle manifest". It is an XML file located at ~/bundle.config
and loaded via BundleManifest.ReadBundleManifest();
at Application_Start
.
CodePlex has an XSD called 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, it is supported scriptBundle
.
source to share
I don't think this is possible , and I think you should really avoid using XML notation. There are practically no resources on the Internet on this topic. So it's faster to rewrite XML in C #. However, there is a NuGet package that will allow you to customize it via XML. An example can be found on GitHub and on the project website .
source to share