本文整理汇总了C#中ScriptBundle类的典型用法代码示例。如果您正苦于以下问题:C# ScriptBundle类的具体用法?C# ScriptBundle怎么用?C# ScriptBundle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScriptBundle类属于命名空间,在下文中一共展示了ScriptBundle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterBundles
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/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 ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
Bundle coffeeBundle = new ScriptBundle("~/bundles/coffee").Include(
"~/Scripts/CoffeeScripts/TestingCoffee.coffee");
coffeeBundle.Transforms.Insert(0,new CoffeeCompiler());
bundles.Add(coffeeBundle);
}
示例2: RegisterBundles
public static void RegisterBundles(BundleCollection bundles)
{
var cssBundle = new StyleBundle("~/bundle/styles").IncludeDirectory("~/css/", "*.css");
bundles.Add(cssBundle);
var JQWidgetsBundle = new ScriptBundle("~/bundle/scripts/widgets").IncludeDirectory("~/scripts/JQwidgets/", "*.js");
bundles.Add(JQWidgetsBundle);
var VueComponents = new ScriptBundle("~/bundle/scripts/VUEComponents").IncludeDirectory("~/scripts/VUEComponents/", "*.js");
VueComponents.Transforms.Clear();
bundles.Add(VueComponents);
var VueComponents2 = new ScriptBundle("~/bundle/scripts/VUE_Components").IncludeDirectory("~/scripts/Vue_Components/", "*.js");
VueComponents2.Transforms.Clear();
bundles.Add(VueComponents2);
var jsCommon = new ScriptBundle("~/bundle/scripts/common");
jsCommon.Transforms.Clear();
jsCommon.Include(new string[]{
"~/scripts/common/moment.js",
"~/scripts/common/chart.js",
"~/scripts/common/materialize.js",
"~/scripts/common/velocity.js",
"~/scripts/common/vue.js",
"~/scripts/common/VueApp.js"
});
bundles.Add(jsCommon);
}
示例3: RegisterBundles
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
var libs = new ScriptBundle("~/bundles/libs");
libs.Include(
"~/wwwroot/lib/jquery/dist/jquery.js",
"~/wwwroot/lib/lodash/lodash.js",
"~/wwwroot/lib/angular/angular.js",
"~/wwwroot/lib/angular-ui-router/release/angular-ui-router.js",
"~/wwwroot/lib/angular-bootstrap/ui-bootstrap-tpls.js",
"~/wwwroot/lib/angular-local-storage/dist/angular-local-storage.js"
);
var app = new ScriptBundle("~/bundles/app");
// Ensure the order is correct
app.Include(
"~/app/app.js",
"~/app/Router.js"
);
app.IncludeDirectory("~/app/", "*.js", true);
bundles.Add(libs);
bundles.Add(app);
}
示例4: UserModelPkg
public UserModelPkg()
{
Name = PackageName;
ScriptBundle = new ScriptBundle("~/Scripts/Apps/shared/UserModel.min.js")
.Include("~/Scripts/Apps/UserModel/UserModel.js");
Category = Categories.Domain;
}
示例5: RegisterBundles
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/Bundles/js").Include(
"~/scripts/jquery-{version}.js",
"~/scripts/bootstrap.js"));
var appBundle = new ScriptBundle("~/Bundles/app").Include(
"~/scripts/angular.js",
"~/scripts/angular-animate.js",
"~/scripts/angular-messages.js",
"~/scripts/angular-resource.js",
"~/scripts/angular-route.js",
"~/scripts/angular-sanitize.js",
"~/scripts/angular-ui-router.js",
"~/scripts/angular-ui/ui-bootstrap.js",
"~/scripts/angular-ui/ui-bootstrap-tpls.js",
"~/Scripts/html5shiv.js",
"~/Scripts/respond.js",
"~/scripts/ngToast.min.js",
"~/scripts/ngToast.min.js");
appBundle.Include(System.Configuration.ConfigurationManager.AppSettings["UseTestData"] == "true"
? "~/scripts/settings-test.js"
: "~/scripts/settings-prod.js");
appBundle.IncludeDirectory("~/app", "*.js", true);
bundles.Add(appBundle);
bundles.Add(new StyleBundle("~/Bundles/css").Include(
"~/content/bootstrap.css",
"~/content/bootstrap2-icons.css",
"~/content/ngToast.min.css",
"~/content/Site.css"));
}
示例6: BundleAndRenderScript
public static IHtmlString BundleAndRenderScript(this HtmlHelper helper, string path, params string[] urls)
{
var bundle = new ScriptBundle(path).Include(urls);
BundleTable.Bundles.Add(bundle);
return Scripts.Render(path);
}
示例7: CreateScriptsBundles
static void CreateScriptsBundles(BundleCollection bundles)
{
var scripts = new ScriptBundle("~/resources/scripts")
.Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery.validate.js",
"~/Scripts/jquery.validate.unobstrusive.js"
);
bundles.Add(scripts);
scripts = new ScriptBundle("~/resources/angular")
.Include(
"~/Scripts/angular.js",
"~/Scripts/angular-resource.js",
"~/Scripts/angular-sanitize.js",
"~/Scripts/i18n/angular-locale_de-de.js",
"~/Scripts/i18n/angular-locale_de.js",
"~/Scripts/jquery.signalR-1.*"
);
bundles.Add(scripts);
scripts = new ScriptBundleWithoutRename("~/resources/sessionvoting")
.Include(
"~/js/Transformations.js",
"~/js/VotingController.js",
"~/js/ResultController.js",
"~/js/SessionVotingServices.js",
"~/js/SessionVoting.js"
);
bundles.Add(scripts);
}
示例8: RegisterBundles
public static void RegisterBundles(BundleCollection Bundles)
{
// Enable optimizations that remove whitespace and size of files without compromising functionality
BundleTable.EnableOptimizations = true;
// Login and sign up bundles
ScriptBundle ScriptBundle = new ScriptBundle("~/bundles/js");
StyleBundle StyleBundle = new StyleBundle("~/bundles/css");
// Editor bundles for code editor in exercise view
ScriptBundle EditorScripts = new ScriptBundle("~/bundles/editorjs");
StyleBundle EditorStyles = new StyleBundle("~/bundles/editorcss");
ScriptBundle.IncludeDirectory("~/Scripts/", "*.js");
StyleBundle.IncludeDirectory("~/Content/", "*.css");
EditorScripts.IncludeDirectory("~/Scripts/Editor/", "*.js");
EditorStyles.IncludeDirectory("~/Content/Editor/", "*.css");
EditorStyles.IncludeDirectory("~/Content/Editor/Themes/", "*.css");
Bundles.Add(ScriptBundle);
Bundles.Add(StyleBundle);
Bundles.Add(EditorScripts);
Bundles.Add(EditorStyles);
}
示例9: RegisterBundles
public static void RegisterBundles(BundleCollection bundles)
{
var frontpageAll = new ScriptBundle("~/bundles/js");
frontpageAll.Include("~/Scripts/lib/jquery-{version}.js")
.Include(
"~/Scripts/lib/jquery.ui.core.js",
"~/Scripts/lib/jquery.ui.widget.js",
"~/Scripts/lib/jquery.ui.position.js",
"~/Scripts/lib/jquery.ui.dialog.js",
"~/Scripts/lib/jquery.ui.mouse.js",
"~/Scripts/lib/jquery.ui.sortable.js",
"~/Scripts/handlebars.js")
.Include("~/Scripts/bootstrap.js")
.IncludeDirectory("~/Scripts/frontpage", "*.js");
var frontpage = new NontestBundle("~/bundles/frontpage", frontpageAll);
var frontpageTest = new TestBundle("~/bundles/frontpage-test", frontpageAll);
bundles.Add(frontpage);
bundles.Add(frontpageTest);
var southStreetTheme = new StyleBundle("~/Content/themes/south-street/all.css")
.IncludeDirectory("~/Content/themes/south-street/", "*.css")
.Include("~/Content/bootstrap.css");
bundles.Add(southStreetTheme);
}
示例10: RegisterBundles
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/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 ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
var reactBundle = new ScriptBundle("~/bundles/reactjs").Include(
"~/scripts/react/react.js",
"~/scripts/react/react-dom.js");
bundles.Add(reactBundle);
}
示例11: BundlingPostStart
private static void BundlingPostStart()
{
var jQueryBundle = new ScriptBundle("~/Scripts/jquery")
.Include("~/Scripts/jquery-{version}.js");
BundleTable.Bundles.Add(jQueryBundle);
ScriptManager.ScriptResourceMapping.AddDefinition("jquery",
new ScriptResourceDefinition
{
Path = jQueryBundle.Path
});
var scriptBundle = new ScriptBundle("~/Scripts/all")
.Include("~/Scripts/jquery-{version}.js")
.Include("~/Scripts/jquery.validate.js")
.Include("~/Scripts/jquery.validate.unobtrusive.js")
.Include("~/Scripts/nugetgallery.js");
BundleTable.Bundles.Add(scriptBundle);
// Modernizr needs to be delivered at the top of the page but putting it in a bundle gets us a cache-buster.
// TODO: Use minified modernizr!
var modernizrBundle = new ScriptBundle("~/Scripts/modernizr")
.Include("~/Scripts/modernizr-{version}.js");
BundleTable.Bundles.Add(modernizrBundle);
var stylesBundle = new StyleBundle("~/Content/css")
.Include("~/Content/site.css");
BundleTable.Bundles.Add(stylesBundle);
}
示例12: IncludeSharedScripts
private static void IncludeSharedScripts(ScriptBundle jsBundle)
{
jsBundle.Include("~/Assets/Scripts/shared/bootbox.js");
jsBundle.Include("~/Assets/Scripts/shared/head.js");
jsBundle.Include("~/Assets/Scripts/shared/tagmanager.js");
jsBundle.Include("~/Assets/Scripts/shared/toastr.js");
}
示例13: GenerateBundleJS
private async static void GenerateBundleJS(ScriptBundle scriptBundle, BundleCollection bundles)
{
string bundleOutputPath = Path.Combine(HttpRuntime.AppDomainAppPath, BundleOutputFile);
BundleContext context = new BundleContext(new HttpContextWrapper(HttpContext.Current), bundles, ScriptsBundleVirtualPath);
System.Text.StringBuilder fileSpacer = new System.Text.StringBuilder();
try
{
using (StreamWriter outputStream = new StreamWriter(bundleOutputPath))
{
outputStream.BaseStream.Seek(0, SeekOrigin.End);
System.Collections.Generic.List<string> filePaths = PrepareFileList(scriptBundle.EnumerateFiles(context));
foreach (string filePath in filePaths)
{
string fileSpacerText = BuildFileSpacer(fileSpacer, filePath);
await outputStream.WriteAsync(fileSpacerText);
using (StreamReader jsFileStream = new StreamReader(filePath))
{
await outputStream.WriteAsync(await jsFileStream.ReadToEndAsync());
}
}
}
}
catch (System.NullReferenceException nullEx)
{
string error = nullEx.Message;
}
}
示例14: AddAppBundles
private static void AddAppBundles(BundleCollection bundles)
{
var scriptBundle = new ScriptBundle(ScriptsBundleVirtualPath);
#if (DEBUG && LOCAL)
var adminAppDirFullPath = Path.Combine(HttpRuntime.AppDomainAppPath, AdminAppDir);
// Create the .NET bundle, then use that list to generate an actual bundle.js file
if (Directory.Exists(adminAppDirFullPath))
{
scriptBundle.Include(
// Order matters, so get the core app setup first
string.Format("~/{0}/app.core.module.js", AdminAppDir),
string.Format("~/{0}/app.module.js", AdminAppDir))
// then get any other top level js files
.IncludeDirectory(string.Format("~/{0}", AdminAppDir), "*.js", false)
// then get all nested module js files
.IncludeDirectory(string.Format("~/{0}", AdminAppDir), "*-module.js", true)
// finally, get all the other js files
.IncludeDirectory(string.Format("~/{0}", AdminAppDir), "*.js", true);
bundles.Add(scriptBundle);
// Generate a new bundle script. This should only be done on a local box as running from the build server causes issues.
GenerateBundleJS(scriptBundle, bundles);
}
#elif (DEBUG && !LOCAL)
scriptBundle.Include(string.Format("~/{0}/briandevlin.bundled.js", "scripts"));
bundles.Add(scriptBundle);
#elif !DEBUG
scriptBundle.Include(string.Format("~/{0}/briandevlin.bundled.js", "scripts"));
bundles.Add(scriptBundle);
#endif
}
示例15: RegisterBundles
public static void RegisterBundles(BundleCollection bundles)
{
var application = new ScriptBundle("~/bundles/application-js")
.Include("~/Scripts/jquery-1.9.1.js")
.Include("~/Scripts/es5-shim.js")
.Include("~/Scripts/batman.js")
.Include("~/Scripts/batman.jquery.js")
.Include("~/Scripts/dashing.coffee")
.Include("~/Scripts/gridster/jquery.leanModal.min.js")
.Include("~/Scripts/jquery.knob.js")
.Include("~/Scripts/d3.v2.min.js")
.Include("~/Scripts/rickshaw.min.js")
.Include("~/Scripts/gridster/jquery.gridster.js")
.Include("~/Scripts/dashing.gridster.coffee")
.IncludeDirectory("~/Widgets", "*.coffee", true)
.Include("~/Scripts/application.coffee");
application.Transforms.Add(new CoffeeTransform());
bundles.Add(application);
var styles = new Bundle("~/bundles/application-css")
.Include("~/Assets/stylesheets/font-awesome.css")
.Include("~/Assets/stylesheets/jquery.gridster.css")
.IncludeDirectory("~/Widgets", "*.scss", true)
.Include("~/Assets/stylesheets/application.scss");
styles.Transforms.Add(new ScssTransform());
bundles.Add(styles);
BundleTable.EnableOptimizations = true;
}