这是我的卡带包代码, 我需要配置,所以它将支持多个css bundels
public class CassetteBundleConfiguration : IConfiguration<BundleCollection>
{
public void Configure(BundleCollection bundles)
{
foreach (var area in Directory.GetDirectories(
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Areas")))
{
if (Directory.Exists(Path.Combine(area, "Scripts/")))
bundles.AddPerSubDirectory<ScriptBundle>(Path.Combine("Areas/", Path.GetFileName(area), "Scripts"), true);
if (Directory.Exists(Path.Combine(area, "Content/")))
bundles.Add<StylesheetBundle>(Path.Combine("Areas/", Path.GetFileName(area), "Content"), bundle => bundle.EmbedImages());
}
}
}
答案 0 :(得分:0)
bundles.Add(new Bundle("Your desired Bundle directory name")
.Include("Virtual Path of file1",
"Virtual Path of file2"
));
试试这样。 include函数接受一个虚拟路径数组作为输入参数。包括如果要在运行时更改css文件的虚拟路径,可以覆盖包含功能。