【问题标题】:Include Directory in Bundle.config在 Bundle.config 中包含目录
【发布时间】:2015-07-12 01:23:03
【问题描述】:

是否可以在Bundle.config 中包含整个目录而不仅仅是一个路径?它比明确说明每个文件要容易得多。

我已经输入了directory 作为include 标签的属性,但自动建议并没有提出任何让我认为不可能的建议?

例如;

<?xml version="1.0" encoding="utf-8" ?>
<bundles version="1.0">
  <styleBundle path="~/Content/css">
    <include path="~/Content/bootstrap/bootstrap.css" />
    <include directory="~/Content/SomeDirectory" />
  </styleBundle>
</bundles>

【问题讨论】:

    标签: asp.net bundling-and-minification


    【解决方案1】:

    作为explained here,有一个XSD 可以确定Bundle.config 文件中的内容。

    include 元素是这样定义的:

    <xs:complexType name="include">
      <xs:attribute name="path" type="xs:string" use="required" />
    </xs:complexType>
    

    所以唯一允许的格式是&lt;include path="~/Content/bootstrap/bootstrap.css" /&gt;,其中path 应该指向一个文件(see ReadBundle() in BundleManifest.cs)。

    【讨论】:

    • 如果我的答案的反对者可以解释我为什么他们反对,我会很高兴。
    猜你喜欢
    • 2017-10-17
    • 2016-08-21
    • 1970-01-01
    • 2010-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-02
    相关资源
    最近更新 更多