Created
September 21, 2012 06:16
-
-
Save ferventcoder/3759985 to your computer and use it in GitHub Desktop.
Cassette Configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@{ | |
Bundles.Reference("content/Site.css"); | |
Bundles.Reference("Scripts"); | |
Bundles.Reference("Scripts/custom"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Bundles the Javascript and CSS files for the web application based on conventions set here. | |
/// </summary> | |
public class CassetteConfiguration : ICassetteConfiguration | |
{ | |
/// <summary> | |
/// Configures the specified bundles. | |
/// </summary> | |
/// <param name="bundles">The bundles.</param> | |
/// <param name="settings">The settings.</param> | |
public void Configure(BundleCollection bundles, CassetteSettings settings) | |
{ | |
// Configure your bundles here... | |
// Please read http://getcassette.net/documentation/configuration | |
// This default configuration treats each file as a separate 'bundle'. | |
// In production the content will be minified, but the files are not combined. | |
// So you probably want to tweak these defaults! | |
//bundles.AddPerIndividualFile<StylesheetBundle>("Content"); | |
//bundles.AddPerIndividualFile<ScriptBundle>("Scripts"); | |
// bundles.AddPerSubDirectory<StylesheetBundle>("Content"); | |
bundles.AddPerIndividualFile<StylesheetBundle>("Content",new FileSearch | |
{ | |
Pattern = "*.css", | |
SearchOption = SearchOption.AllDirectories, | |
}); | |
if (ApplicationParameters.IsDebug) | |
{ | |
bundles.AddPerSubDirectory<ScriptBundle>("Scripts", new FileSearch | |
{ | |
Pattern = "*.js;*.coffee", | |
SearchOption = SearchOption.AllDirectories, | |
Exclude = new Regex("-vsdoc\\.js$|\\.min\\.js$") | |
}); | |
} | |
else | |
{ | |
bundles.AddPerSubDirectory<ScriptBundle>("Scripts", new FileSearch | |
{ | |
Pattern = "*.js;*.coffee", | |
SearchOption = SearchOption.AllDirectories, | |
Exclude = new Regex("-vsdoc\\.js$|\\.min\\.js$|\\.debug\\.js$") | |
}); | |
} | |
this.Log().Debug(() => "Cassette is now configured..."); | |
// To combine files, try something like this instead: | |
// bundles.Add<StylesheetBundle>("Content"); | |
// In production mode, all of ~/Content will be combined into a single bundle. | |
// If you want a bundle per folder, try this: | |
// bundles.AddPerSubDirectory<ScriptBundle>("Scripts"); | |
// Each immediate sub-directory of ~/Scripts will be combined into its own bundle. | |
// This is useful when there are lots of scripts for different areas of the website. | |
// *** TOP TIP: Delete all ".min.js" files now *** | |
// Cassette minifies scripts for you. So those files are never used. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment