本文整理汇总了C#中Bundle.IncludeDirectory方法的典型用法代码示例。如果您正苦于以下问题:C# Bundle.IncludeDirectory方法的具体用法?C# Bundle.IncludeDirectory怎么用?C# Bundle.IncludeDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bundle
的用法示例。
在下文中一共展示了Bundle.IncludeDirectory方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterBundles
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
#if !DEBUG
BundleTable.EnableOptimizations = true;
#endif
var nullBuilder = new NullBuilder();
var styleTransformer = new StyleTransformer();
var nullOrderer = new NullOrderer();
//
// CUSTOM
//
var sb = new ScriptBundle("~/bundles/scripts");
sb.IncludeDirectory("~/assets/js/", "*.js", true);
bundles.Add(sb);
var styleBundle = new Bundle("~/bundles/styles");
styleBundle.IncludeDirectory("~/assets/style/", "*.css", true);
styleBundle.IncludeDirectory("~/assets/style/", "*.less", true);
styleBundle.Builder = nullBuilder;
styleBundle.Transforms.Add(styleTransformer);
styleBundle.Orderer = nullOrderer;
bundles.Add(styleBundle);
}
示例2: RegisterStyles
/// <summary>
/// Registers the styles.
/// </summary>
/// <param name="bundles">The bundles.</param>
public static void RegisterStyles(BundleCollection bundles)
{
var attendeeLessBundle = new Bundle("~/AttendeeStyles/");
attendeeLessBundle.Include("~/Styles/Attendee/Variables.less");
attendeeLessBundle.IncludeDirectory("~/Styles/", "*.less", false);
attendeeLessBundle.Include("~/Styles/Attendee/Global.less");
attendeeLessBundle.IncludeDirectory("~/Styles/Attendee/Pages", "*.less", false);
attendeeLessBundle.Transforms.Add(new LessTransform());
attendeeLessBundle.Transforms.Add(new CssMinify());
bundles.Add(attendeeLessBundle);
var organizerLessBundle = new Bundle("~/OrganizerStyles/");
organizerLessBundle.Include("~/Styles/Organizer/Variables.less");
organizerLessBundle.IncludeDirectory("~/Styles/", "*.less", false);
organizerLessBundle.Include("~/Styles/Organizer/Global.less");
organizerLessBundle.IncludeDirectory("~/Styles/Organizer/Pages", "*.less", false);
organizerLessBundle.Transforms.Add(new LessTransform());
organizerLessBundle.Transforms.Add(new CssMinify());
bundles.Add(organizerLessBundle);
var mobileCssBundle = new Bundle("~/MobileStyles/");
mobileCssBundle.Include("~/Styles/Mobile/myevent.mobile.css");
mobileCssBundle.IncludeDirectory("~/Styles/Mobile/", "*.css", false);
mobileCssBundle.Transforms.Add(new CssMinify());
bundles.Add(mobileCssBundle);
}
示例3: Application_Start
protected void Application_Start(object sender, EventArgs e)
{
// Create frameworks bundle: JQuery and Underscore in our case
var coreJs = new Bundle("~/core.js");
coreJs.IncludeDirectory("~/scripts/", "*.js");
BundleTable.Bundles.Add(coreJs);
Debugger.Launch();
// Create app bundle:
// main.html is underscore template
// app.js is our simple application
var appJs = new Bundle("~/app.js");
appJs.Include("~/scripts/app/main.html");
appJs.Include("~/scripts/app/example2.html");
appJs.Include("~/scripts/app/app.js");
//appJs.Transforms.Add(new NoTransform("text/javascript; charset=utf-8"));
// You can minify bundle if you want
//cartJs.Transform = new JsMinify();
appJs.Builder = new CompiledUndrescoreTemplatesBundler();
BundleTable.Bundles.Add(appJs);
}
示例4: RegisterBundles
void RegisterBundles(BundleCollection bundles)
{
//Add a bundle to minify JS files on release mode.
var myBundle = new Bundle("~/Scripts/myBundle");
myBundle.IncludeDirectory("~/Public/js", "*.js");
bundles.Add(myBundle);
}
示例5: RegisterBundles
public static void RegisterBundles(BundleCollection bundles)
{
BundleTable.EnableOptimizations = true;
Console.WriteLine("Registering SucroseBundle");
var coreBundle = new ScriptBundle("~/Bundles/sucrose");
var tsBundle = new Bundle("~/Bundles/typescript", new WrapperTransform());
try
{
coreBundle.IncludeDirectory("~/Scripts/Sucrose", "*.js");
}
catch (ArgumentException)
{
}
try
{
tsBundle.IncludeDirectory("~/TypeScript", "*.ts");
}
catch (ArgumentException)
{
}
bundles.Add(coreBundle);
bundles.Add(tsBundle);
}
示例6: LoadStyleBundles
public static void LoadStyleBundles()
{
var bundles = BundleTable.Bundles.Where(b => b.Path.StartsWith("~/Theme/") && b.Path.EndsWith("/css")).ToList();
bundles.ForEach(bundle => BundleTable.Bundles.Remove(bundle));
List<string> themes = new List<string>();
var domainService = (IDomain)DependencyResolver.Current.GetService(typeof(IDomain));
if (domainService != null)
themes = domainService.GetAllDomains().Select(d => d.DO_Theme).ToList();
var server = HttpContext.Current.Server;
foreach (var theme in themes)
{
var template = theme ?? SettingsManager.DefaultWebTheme;
string vpath = String.Format("~/Theme/{0}/css", template);
string path = String.Format("~/Themes/{0}/css", template);
if (BundleTable.Bundles.Any(b => b.Path == vpath))
continue;
if (!Directory.Exists(server.MapPath(path)))
continue;
Bundle bundle = new Bundle(vpath, new CssMinify());
bundle.IncludeDirectory(path, "*.css");
BundleTable.Bundles.Add(bundle);
}
}
示例7: RegisterBundles
public static void RegisterBundles(BundleCollection bundles)
{
var cssBundle = new Bundle("~/content/css", new CssMinify());
cssBundle.Include("~/content/bootstrap.min.css");
cssBundle.Include("~/content/bootstrap-custom.css");
cssBundle.Include("~/content/bootstrap-responsive.min.css");
cssBundle.IncludeDirectory("~/content", "typeset*.css", true);
bundles.Add(cssBundle);
var jsBundle = new Bundle("~/scripts/js/all", new JsMinify());
jsBundle.Include("~/scripts/bootstrap.min.js");
jsBundle.IncludeDirectory("~/scripts", "typeset*.js", true);
bundles.Add(jsBundle);
BundleTable.EnableOptimizations = true;
}
示例8: RegisterBundles
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery.ui.core.css",
"~/Content/themes/base/jquery.ui.resizable.css",
"~/Content/themes/base/jquery.ui.selectable.css",
"~/Content/themes/base/jquery.ui.accordion.css",
"~/Content/themes/base/jquery.ui.autocomplete.css",
"~/Content/themes/base/jquery.ui.button.css",
"~/Content/themes/base/jquery.ui.dialog.css",
"~/Content/themes/base/jquery.ui.slider.css",
"~/Content/themes/base/jquery.ui.tabs.css",
"~/Content/themes/base/jquery.ui.datepicker.css",
"~/Content/themes/base/jquery.ui.progressbar.css",
"~/Content/themes/base/jquery.ui.theme.css"));
var mugScript = new ScriptBundle("~/bundles/mug");
mugScript.Include("~/Scripts/knockout-2.1.0.debug.js");
mugScript.Include("~/Scripts/mustache.js");
mugScript.Include("~/Scripts/ko.mustache.js");
mugScript.Include("~/Scripts/script.js");
mugScript.IncludeDirectory("~/Scripts/ViewModel", "*.js");
mugScript.IncludeDirectory("~/Scripts/Utils", "*.js");
bundles.Add(mugScript);
var bundle = new Bundle("~/Content/template");
bundle.Transforms.Add(new TemplateTransform());
bundle.IncludeDirectory("~/Views", "*.mustache", true);
bundles.Add(bundle);
}
示例9: RegisterBundles
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
public static void RegisterBundles(BundleCollection bundles)
{
bundles.UseCdn = true;
var nullBuilder = new NullBuilder();
var nullOrderer = new NullOrderer();
// Replace a default bundle resolver in order to the debugging HTTP-handler
// can use transformations of the corresponding bundle
BundleResolver.Current = new CustomBundleResolver();
var commonStylesBundle = new CustomStyleBundle("~/Bundles/CommonStyles");
commonStylesBundle.Include(
"~/Content/Fonts.css",
"~/Content/Site.css",
"~/Content/BundleTransformer.css",
"~/AlternativeContent/css/TestCssComponentsPaths.css",
"~/Content/themes/base/jquery.ui.core.css",
"~/Content/themes/base/jquery.ui.theme.css",
"~/Content/themes/base/jquery.ui.resizable.css",
"~/Content/themes/base/jquery.ui.button.css",
"~/Content/themes/base/jquery.ui.dialog.css",
"~/Content/TestTranslators.css",
"~/Content/less/TestLess.less",
"~/Content/sass/TestSass.sass",
"~/Content/scss/TestScss.scss");
commonStylesBundle.Orderer = nullOrderer;
bundles.Add(commonStylesBundle);
var modernizrBundle = new CustomScriptBundle("~/Bundles/Modernizr");
modernizrBundle.Include("~/Scripts/modernizr-2.*");
modernizrBundle.Orderer = nullOrderer;
bundles.Add(modernizrBundle);
var jQueryBundle = new CustomScriptBundle("~/Bundles/Jquery",
"http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.2.min.js");
jQueryBundle.Include("~/Scripts/jquery-{version}.js");
jQueryBundle.Orderer = nullOrderer;
jQueryBundle.CdnFallbackExpression = "window.jquery";
bundles.Add(jQueryBundle);
var commonScriptsBundle = new CustomScriptBundle("~/Bundles/CommonScripts");
commonScriptsBundle.Include(
"~/Scripts/MicrosoftAjax.js",
"~/Scripts/jquery-ui-{version}.js",
"~/Scripts/jquery.validate.js",
"~/Scripts/jquery.validate.unobtrusive.js",
"~/Scripts/jquery.unobtrusive-ajax.js",
"~/Scripts/knockout-3.*",
"~/Scripts/coffee/TestCoffeeScript.coffee",
"~/Scripts/coffee/TestLiterateCoffeeScript.litcoffee",
"~/Scripts/coffee/TestCoffeeScriptMarkdown.coffee.md",
"~/Scripts/ts/TranslatorBadge.ts",
"~/Scripts/ts/ColoredTranslatorBadge.ts",
"~/Scripts/ts/TestTypeScript.ts");
commonScriptsBundle.Orderer = nullOrderer;
bundles.Add(commonScriptsBundle);
var commonTemplatesBundle = new CustomScriptBundle("~/Bundles/CommonTemplates");
commonTemplatesBundle.Include(
"~/Scripts/hogan/template-{version}.js",
"~/Scripts/hogan/HoganTranslatorBadge.mustache",
"~/Scripts/hogan/TestHogan.js",
"~/Scripts/handlebars/handlebars.runtime.js",
"~/Scripts/handlebars/HandlebarsHelpers.js",
"~/Scripts/handlebars/HandlebarsTranslatorBadge.handlebars",
"~/Scripts/handlebars/TestHandlebars.js");
commonTemplatesBundle.Orderer = nullOrderer;
bundles.Add(commonTemplatesBundle);
var jqueryUiStylesDirectoryBundle = new Bundle("~/Bundles/JqueryUiStylesDirectory")
{
Builder = nullBuilder
};
jqueryUiStylesDirectoryBundle.IncludeDirectory("~/Content/themes/base/", "*.css");
jqueryUiStylesDirectoryBundle.Transforms.Add(new StyleTransformer(
new[] { "*.all.css", "jquery.ui.base.css" }));
bundles.Add(jqueryUiStylesDirectoryBundle);
var scriptsDirectoryBundle = new Bundle("~/Bundles/ScriptsDirectory")
{
Builder = nullBuilder
};
scriptsDirectoryBundle.IncludeDirectory("~/Scripts/", "*.js", true);
scriptsDirectoryBundle.Transforms.Add(new ScriptTransformer(
new[] { "*.all.js", "_references.js" }));
bundles.Add(scriptsDirectoryBundle);
}