galrave galrave - 6 months ago 31
CSS Question

c# cassette - how to create different css bundles for different pages

this is my cassette bundle code,
i nead to configure in so it will support multiple 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());

bundles.Add(new Bundle("Your desired Bundle directory name")
                .Include("Virtual Path of file1",
                "Virtual Path of file2"

Try like this. The include function accepts an array of virtual paths as input argument. Include You can override Include function if you want to change the virtual path of your css files at run time.