Documentation

Add File

A bundle can be added using a single file, for example, a .less with additional @import statements. Each file set can then be a Cassette bundle.

Here's an example structure:

Content/
- Libraries/
  - primary.less
  - reset.less
  - variables.less

Inside of primary.less could exist an @import structure:

@import "reset.less";
@import "variables.less";

By explicitly specifying a file, Cassette only loads that file and the assets specified by that file.

public class CassetteConfiguration : ICassetteConfiguration
{
    public void Configure(BundleCollection bundles, CassetteSettings settings)
    {
        bundles.Add<StylesheetBundle>("Content/Libraries/primary.less");
    }
}

Multiple Files

A bundle can also be created from multiple, disjointed files, such as several single files in multiple directories.

Again, an example structure:

Content/
- Libraries/
  - primary.less
  - reset.less
  - variables.less
- InHouse/
  - site.less

The Add<T> method contains an overload accepting an IEnumerable<string> of file names:

public class CassetteConfiguration : ICassetteConfiguration
{
    public void Configure(BundleCollection bundles, CassetteSettings settings)
    {
        var files = new [] { 
			"Content/Libraries/primary.less", 
			"Content/InHouse/site.less"
	};
        bundles.Add<StylesheetBundle>("styles", files);
    }
}

In this example, "styles" becomes the referenced bundle alias for both of these files.

Bundles.Reference("styles");