本文整理汇总了C#中Bundle.Include方法的典型用法代码示例。如果您正苦于以下问题:C# Bundle.Include方法的具体用法?C# Bundle.Include怎么用?C# Bundle.Include使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bundle
的用法示例。
在下文中一共展示了Bundle.Include方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例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: EnableRaphaelBundles
public static void EnableRaphaelBundles(this BundleCollection bundles)
{
var raphaelJs = new Bundle("~/raphael/js");
raphaelJs.Include("~/Scripts/raphael-min.js");
raphaelJs.Include("~/Scripts/g.raphael-min.js");
raphaelJs.Include("~/Scripts/g.line-min.js");
bundles.Add(raphaelJs);
}
示例4: 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");
bundles.Add(cssBundle);
var javascriptBundle = new Bundle("~/scripts/javascript", new JsMinify());
javascriptBundle.Include("~/scripts/bootstrap.min.js");
bundles.Add(javascriptBundle);
BundleTable.EnableOptimizations = true;
}
示例5: RegisterBundles
public static void RegisterBundles(BundleCollection bundles)
{
var cssTransformer = new CssTransformer();
var jsTransformer = new JsTransformer();
var commonStylesBundle = new Bundle("~/css");
commonStylesBundle.Include(
"~/Content/less/bootstrap.less");
commonStylesBundle.Transforms.Add(cssTransformer);
bundles.Add(commonStylesBundle);
var modernizrBundle = new Bundle("~/modernizr");
modernizrBundle.Include("~/Scripts/modernizr-2.*");
modernizrBundle.Transforms.Add(jsTransformer);
bundles.Add(modernizrBundle);
var commonScriptsBundle = new Bundle("~/jquery");
commonScriptsBundle.Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery-migrate-{version}.js"
);
commonScriptsBundle.Transforms.Add(jsTransformer);
bundles.Add(commonScriptsBundle);
var jqueryDependentScriptsBundle = new Bundle("~/js");
jqueryDependentScriptsBundle.Include(
"~/Scripts/bootstrap.js",
"~/Scripts/jquery.validate.js",
"~/Scripts/jquery.validate.unobtrusive.js"
, "~/Scripts/jquery.unobtrusive-ajax.js");
jqueryDependentScriptsBundle.Transforms.Add(jsTransformer);
bundles.Add(jqueryDependentScriptsBundle);
}
示例6: GetBundle
private static Bundle GetBundle(string name, string[] paths, string namePrefix, string pathPrefix)
{
var bundle = new Bundle(string.Format("{0}/{1}", namePrefix, name));
foreach (var path in paths)
bundle.Include(string.Format("{0}/{1}", pathPrefix, path));
return bundle;
}
示例7: 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/js/jquery")
.Include("~/public/js/lib/jquery-{version}.js")
.Include("~/public/js/lib/jquery.tmpl.js"));
bundles.Add(new ScriptBundle("~/bundles/js/jqueryval").Include(
"~/public/js/lib/jquery.unobtrusive*",
"~/public/js/lib/jquery.validate*"));
bundles.Add(new ScriptBundle("~/bundles/js/bootstrap")
.Include("~/public/js/lib/bootstrap.js")
.Include("~/public/js/lib/bootstrap-mvc.js"));
bundles.Add(new ScriptBundle("~/bundles/js/game")
.Include("~/public/js/Game.js"));
var css = new Bundle("~/bundles/css/site");
css.Include("~/public/css/bootstrap.css")
.Include("~/public/css/bootstrap-responsive.css")
.Include("~/public/css/site.less");
css.Transforms.Add(new CssTransformer());
css.Orderer = new NullOrderer();
bundles.Add(css);
}
示例8: RegisterBundles
public static void RegisterBundles(BundleCollection bundles)
{
var cssTransformer = new CssTransformer();
var jsTransformer = new JsTransformer();
var nullOrderer = new NullOrderer();
var commonStylesBundle = new Bundle("~/Bundles/CommonStyles");
commonStylesBundle.Include(
"~/Content/less/bootstrap.less",
"~/Content/less/responsive.less");
commonStylesBundle.Transforms.Add(cssTransformer);
commonStylesBundle.Orderer = nullOrderer;
bundles.Add(commonStylesBundle);
var commonScriptsBundle = new Bundle("~/Bundles/CommonScripts");
commonScriptsBundle.Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/less.min.js",
"~/Scripts/bootstrap.js",
"~/Scripts/angular.js",
"~/Scripts/linq.js");
commonScriptsBundle.Transforms.Add(jsTransformer);
commonScriptsBundle.Orderer = nullOrderer;
bundles.Add(commonScriptsBundle);
}
示例9: RegisterBundles
public static void RegisterBundles(BundleCollection bundles)
{
bundles.UseCdn = true;
var nullBuilder = new NullBuilder();
var cssTransformer = new CssTransformer();
var jsTransformer = new JsTransformer();
var nullOrderer = new NullOrderer();
/*Common Styles */
var commonStylesBundle = new Bundle("~/Bundles/CommonStyles");
commonStylesBundle.Include("~/Content/bootstrap.css");
commonStylesBundle.Builder = nullBuilder;
commonStylesBundle.Transforms.Add(cssTransformer);
commonStylesBundle.Orderer = nullOrderer;
bundles.Add(commonStylesBundle);
/*App Css */
var appStylesBundle = new Bundle("~/Bundles/AppStyles");
appStylesBundle.Include(
"~/App/css/base.css",
"~/App/css/custom.css");
appStylesBundle.Builder = nullBuilder;
appStylesBundle.Transforms.Add(cssTransformer);
appStylesBundle.Orderer = nullOrderer;
bundles.Add(appStylesBundle);
}
示例10: RegisterBundles
public static void RegisterBundles()
{
BundleTable.Bundles.Clear();
BundleTable.Bundles.ResetAll();
BundleTable.Bundles.Add(new StyleBundle("~/bundles/css")
.Include("~/Content/bootstrap.css")
.Include("~/Content/bootstrap-responsive.css")
.Include("~/Content/css/fd.css"));
var applicationRoot = HttpContext.Current.Server.MapPath("~");
var files = Directory.EnumerateFiles(
applicationRoot + "/Scripts/Views/", "*.js",
SearchOption.AllDirectories);
var fileInfos = files.Where(file => true).Select(file => new FileInfo(file.ToLowerInvariant())).ToArray();
foreach (var source in fileInfos)
{
var script = File.ReadAllText(source.FullName);
var match = DependencyRegex.Match(script);
var bundlePath = "~/bundles/" + source.Name.Split('.')[0];
var bundle = new Bundle(bundlePath);
while (match.Success)
{
var path = match.Groups["path"].Value;
bundle.Include(path);
match = match.NextMatch();
}
bundle.Include("~/Scripts/Views/" + source.Directory.Name + "/" + source.Name);
#if !DEBUG
bundle.Transforms.Add(new JsMinify());
#endif
BundleTable.Bundles.Add(bundle);
}
BundleTable.EnableOptimizations = true;
}
示例11: EnableBootstrapBundles
public static void EnableBootstrapBundles(this BundleCollection bundles)
{
var bootstrapCss = new Bundle("~/bootstrap/css", new CssMinify());
bootstrapCss.Include("~/Content/bootstrap.css");
bootstrapCss.Include("~/Content/bootstrap-responsive.css");
bootstrapCss.Include("~/Content/application.css");
bundles.Add(bootstrapCss);
var bootstrapJs = new Bundle("~/bootstrap/js", new JsMinify());
bootstrapJs.Include("~/Scripts/jquery-1.7.1.js");
bootstrapJs.Include("~/Scripts/bootstrap.js");
bootstrapJs.Include("~/Scripts/jquery.unobtrusive-ajax.js");
bootstrapJs.Include("~/Scripts/jquery.validate.js");
bootstrapJs.Include("~/Scripts/jquery.validate.unobtrusive.js");
bootstrapJs.Include("~/Scripts/knockout.js");
bootstrapJs.Include("~/Scripts/modernizr-2.5.3.js");
bootstrapJs.Include("~/Scripts/site.js");
bundles.Add(bootstrapJs);
}
示例12: RegisterBundles
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254726
public static void RegisterBundles(BundleCollection bundles)
{
//This setting is used when if you have specfied the path Using System.web.Optimization.bundle.Cdnpath then it will try to fetch data from there first
bundles.UseCdn = true;
//NullBuilder class is responsible for prevention of early applying of the item transformations and combining of code.
var nullBuilder = new NullBuilder();
//StyleTransformer and ScriptTransformer classes produce processing of stylesheets and scripts.
var styleTransformer = new StyleTransformer();
var scriptTransformer = new ScriptTransformer();
//NullOrderer class disables the built-in sorting mechanism and save assets sorted in the order they are declared.
var nullOrderer = new NullOrderer();
//create your own scriptbundle
var scriptbundleToObfuscate = new Bundle("~/bundles/WebFormsJs");
scriptbundleToObfuscate.Include("~/Scripts/WebForms/WebForms.js",
"~/Scripts/WebForms/WebUIValidation.js",
"~/Scripts/WebForms/MenuStandards.js",
"~/Scripts/WebForms/Focus.js",
"~/Scripts/WebForms/GridView.js",
"~/Scripts/WebForms/DetailsView.js",
"~/Scripts/WebForms/TreeView.js",
"~/Scripts/WebForms/WebParts.js");
scriptbundleToObfuscate.Builder = nullBuilder;
scriptbundleToObfuscate.Transforms.Add(scriptTransformer);
scriptbundleToObfuscate.Orderer = nullOrderer;
bundles.Add(scriptbundleToObfuscate);
//bundles.Add(new ScriptBundle("~/bundles/WebFormsJs").Include(
// "~/Scripts/WebForms/WebForms.js",
// "~/Scripts/WebForms/WebUIValidation.js",
// "~/Scripts/WebForms/MenuStandards.js",
// "~/Scripts/WebForms/Focus.js",
// "~/Scripts/WebForms/GridView.js",
// "~/Scripts/WebForms/DetailsView.js",
// "~/Scripts/WebForms/TreeView.js",
// "~/Scripts/WebForms/WebParts.js"));
bundles.Add(new ScriptBundle("~/bundles/MsAjaxJs").Include(
"~/Scripts/WebForms/MsAjax/MicrosoftAjax.js",
"~/Scripts/WebForms/MsAjax/MicrosoftAjaxApplicationServices.js",
"~/Scripts/WebForms/MsAjax/MicrosoftAjaxTimer.js",
"~/Scripts/WebForms/MsAjax/MicrosoftAjaxWebForms.js"));
// 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-*"));
BundleTable.EnableOptimizations = true;
}
示例13: createBundle
private static Bundle createBundle(string name, string[] paths, string type)
{
var bundle = new Bundle(name);
foreach (string s in paths)
{
bundle.Include(s);
}
bundle.Builder = nullBuilder;
if (type.Equals("style")) bundle.Transforms.Add(styleTransformer);
else if (type.Equals("script")) bundle.Transforms.Add(scriptTransformer);
bundle.Orderer = nullOrderer;
return bundle;
}
示例14: RegisterBundles
public static void RegisterBundles(BundleCollection bundles)
{
var combined = new Bundle(
"~/scripts/combined",
new CombinedCoffeeScriptTransform(),
new JsMinify());
combined.Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/coffeescript/app.coffee");
bundles.Add(combined);
}
示例15: RegisterBundles
public static void RegisterBundles(BundleCollection bundles)
{
var stylesBundle = new Bundle("~/Static/Styles");
stylesBundle.Include("~/Static/css/site.css");
bundles.Add(stylesBundle);
var scriptsBundle = new ScriptBundle("~/Static/Scripts");
scriptsBundle.Include(
"~/Static/lib/jquery-1.10.2.js",
"~/Static/lib/bootstrap3/js/bootstrap.js",
"~/Static/lib/knockout-3.2.0.js",
"~/Static/lib/sprintf.js");
bundles.Add(scriptsBundle);
}