public AngularPartialsTransform(string moduleName, IBundleTransform nextTransform = null) { _moduleName = moduleName; _nextTransform = nextTransform ?? new JsMinify(); RemoveLeadingSlash = false; }
public CustomStyleBundle(string virtualPath, IBundleTransform bundleTransform = null) : base(virtualPath, new IBundleTransform[1] { bundleTransform ?? new CustomCssMinify() }) { }
public CustomStyleBundle(string virtualPath, IBundleTransform bundleTransform = null) : base(virtualPath, new IBundleTransform[1] { bundleTransform ?? new CustomCssMinify() }) { }
protected void Application_Start() { data.Migrations.Configuration.MigrateToLatestVersion(); // Cache = MemoryCache.Default; var transforms = new IBundleTransform[] { new JsMinify() }; var libs = new Bundle("~/Scripts/libs", transforms) .Include("~/Scripts/angular.js") .Include("~/Scripts/angular-ui.js") .IncludeDirectory("~/Scripts/", "*.js"); //.IncludeDirectory("~/Scripts/", "*.ts"); var adminBundle = new Bundle("~/Scripts/admin_scripts", transforms) .IncludeDirectory("~/Scripts/Admin", "*.js") .IncludeDirectory("~/Scripts/Admin", "*.coffee") .IncludeDirectory("~/Scripts/Controllers", "*.js") .IncludeDirectory("~/Scripts/Controllers", "*.coffee") .IncludeDirectory("~/Scripts/modules", "*.js"); BundleTable.Bundles.Add(libs); BundleTable.Bundles.Add(adminBundle); AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); SharedLayer.Init(); }
public static void RegisterBundles(BundleCollection bundles) { BundleTable.EnableOptimizations = false; IBundleTransform[] jsTransforms = new IBundleTransform[0]; IBundleTransform[] cssTransforms = new IBundleTransform[0]; Bundle angularMaterialBundle = new Bundle("~/Areas/M/angular-material", cssTransforms); angularMaterialBundle.Include("~/Areas/M/Content/angular-material/angular-material.css"); bundles.Add(angularMaterialBundle); Bundle angularBundle = new Bundle("~/Areas/M/angular", jsTransforms); angularBundle.Include("~/Areas/M/Scripts/angular.js"); angularBundle.Include("~/Areas/M/Scripts/angular-aria.js"); angularBundle.Include("~/Areas/M/Scripts/angular-animate.js"); angularBundle.Include("~/Areas/M/Scripts/angular-material.js"); angularBundle.Include("~/Areas/M/Scripts/angular-route.js"); bundles.Add(angularBundle); Bundle appModuleBundle = new Bundle("~/Areas/M/module", jsTransforms); appModuleBundle.Include("~/Areas/M/App/app.module.js"); bundles.Add(appModuleBundle); Bundle testsBundle = new Bundle("~/Areas/M/tests", jsTransforms); testsBundle.Include("~/Areas/M/App/Tests/Services/tests.service.js"); testsBundle.Include("~/Areas/M/App/Tests/tests.controller.js"); bundles.Add(testsBundle); }
public static void RegisterBundles(BundleCollection bundles) { BundleTable.EnableOptimizations = false; IBundleTransform[] jsTransforms = new IBundleTransform[0]; IBundleTransform[] cssTransforms = new IBundleTransform[0]; Bundle angularMaterialBundle = new Bundle("~/Areas/M/angular-material", cssTransforms); angularMaterialBundle.Include("~/Areas/M/Content/angular-material/angular-material.css"); angularMaterialBundle.Include("~/Areas/M/Content/angular-material/admins.style.css"); angularMaterialBundle.Include("~/Areas/M/Content/sections.css"); angularMaterialBundle.Include("~/Areas/M/app/MenuBar.StyleSheet.css"); bundles.Add(angularMaterialBundle); Bundle materialLiteBundle = new Bundle("~/Content/mdl", cssTransforms); materialLiteBundle.Include("~/Content/mdl-v1.1.2/material.css"); materialLiteBundle.Include("~/Areas/M/Content/table.style.css"); bundles.Add(materialLiteBundle); Bundle angularBundle = new Bundle("~/Areas/M/angular", jsTransforms); angularBundle.Include("~/Areas/M/Scripts/angular.js"); angularBundle.Include("~/Areas/M/Scripts/angular-aria.js"); angularBundle.Include("~/Areas/M/Scripts/angular-animate.js"); angularBundle.Include("~/Areas/M/Scripts/angular-material.js"); angularBundle.Include("~/Areas/M/Scripts/angular-route.js"); angularBundle.Include("~/Content/mdl-v1.1.2/material.js"); bundles.Add(angularBundle); Bundle appModuleBundle = new Bundle("~/Areas/M/module", jsTransforms); appModuleBundle.Include("~/Areas/M/app/app.module.js"); bundles.Add(appModuleBundle); Bundle controllerBundle = new Bundle("~/Areas/M/AngularControllers", jsTransforms); controllerBundle.Include("~/Areas/M/app/mainbar/mainbar.controller.js"); controllerBundle.Include("~/Areas/M/app/ckeditor/ck-editor.directive.js"); controllerBundle.Include("~/Areas/M/app/tests/tests.controller.js"); controllerBundle.Include("~/Areas/M/app/questions/questions.controller.js"); controllerBundle.Include("~/Areas/M/app/questions/questions-edit.controller.js"); controllerBundle.Include("~/Areas/M/app/questions/questions-add.controller.js"); controllerBundle.Include("~/Areas/M/app/sections/sections.controller.js"); controllerBundle.Include("~/Areas/M/app/sections/section-save.controller.js"); controllerBundle.Include("~/Areas/M/app/admins/admins.controller.js"); controllerBundle.Include("~/Areas/M/app/admins/admin-save.controller.js"); bundles.Add(controllerBundle); Bundle serviceBundle = new Bundle("~/Areas/M/AngularServices", jsTransforms); serviceBundle.Include("~/Areas/M/app/common/services/guids.service.js"); serviceBundle.Include("~/Areas/M/app/common/services/httpService.service.js"); serviceBundle.Include("~/Areas/M/app/tests/tests.service.js"); serviceBundle.Include("~/Areas/M/app/questions/questions.service.js"); serviceBundle.Include("~/Areas/M/app/sections/sections.service.js"); serviceBundle.Include("~/Areas/M/app/admins/admins.service.js"); bundles.Add(serviceBundle); }
public AngularPartialsTransform(string moduleName, IBundleTransform nextTransform = null) { _moduleName = moduleName; _nextTransform = nextTransform ?? new JsMinify(); RemoveLeadingSlash = false; }
/// <summary>Gets a JS transformer from bundle</summary> /// <param name="bundle">Bundle</param> /// <returns>JS transformer</returns> protected override ITransformer GetTransformer(Bundle bundle) { IBundleTransform bundleTransform = (IBundleTransform)null; if (bundle != null) { bundleTransform = bundle.Transforms.FirstOrDefault <IBundleTransform>((Func <IBundleTransform, bool>)(t => t is ScriptTransformer)); } return((ITransformer)bundleTransform); }
public static void RegisterBundles_GetAPet(BundleCollection bundles) { BundleTable.EnableOptimizations = false; IBundleTransform[] jsTransforms = new IBundleTransform[0]; IBundleTransform[] cssTransforms = new IBundleTransform[0]; Bundle angularMaterialBundle = new Bundle("~/angular-material", cssTransforms); angularMaterialBundle.Include("~/Content/angular-material/angular-material.css"); angularMaterialBundle.Include("~/Content/angular-material/bootstrap.css"); bundles.Add(angularMaterialBundle); Bundle materialLiteBundle = new Bundle("~/Content/mdl", cssTransforms); materialLiteBundle.Include("~/Content/mdl-v1.1.2/material.css"); bundles.Add(materialLiteBundle); Bundle angularBundle = new Bundle("~/angular", jsTransforms); angularBundle.Include("~/Scripts/angular/angular.js"); angularBundle.Include("~/Scripts/angular/angular-aria.js"); angularBundle.Include("~/Scripts/angular/angular-animate.js"); angularBundle.Include("~/Scripts/angular/angular-material.js"); angularBundle.Include("~/Scripts/angular/angular-route.js"); angularBundle.Include("~/Content/mdl-v1.1.2/material.js"); bundles.Add(angularBundle); Bundle appModuleBundle = new Bundle("~/module", jsTransforms); appModuleBundle.Include("~/app/app.module.js"); bundles.Add(appModuleBundle); Bundle controllerBundle = new Bundle("~/AngularControllers", jsTransforms); controllerBundle.Include("~/app/home/home.controller.js"); controllerBundle.Include("~/app/home/home.service.js"); controllerBundle.Include("~/app/user/user.service.js"); controllerBundle.Include("~/app/user/userdetails.controller.js"); controllerBundle.Include("~/app/myPets/mypets.controller.js"); controllerBundle.Include("~/app/myPets/mypets.service.js"); controllerBundle.Include("~/app/myPets/pet-save.controller.js"); controllerBundle.Include("~/app/myPets/pet-edit.controller.js"); controllerBundle.Include("~/app/conversations/conversations.controller.js"); controllerBundle.Include("~/app/conversations/conversation.controller.js"); controllerBundle.Include("~/app/conversations/conversations.service.js"); controllerBundle.Include("~/app/conversations/messages.service.js"); controllerBundle.Include("~/app/myPets/pet.view.controller.js"); controllerBundle.Include("~/app/uploads/uploads.controller.js"); controllerBundle.Include("~/app/uploads/uploads.service.js"); controllerBundle.Include("~/app/uploads/loading-spinner.js"); bundles.Add(controllerBundle); }
/// <summary> /// Gets a CSS transformer from bundle /// </summary> /// <param name="bundle">Bundle</param> /// <returns>CSS transformer</returns> protected override ITransformer GetTransformer(Bundle bundle) { IBundleTransform transformer = null; if (bundle != null) { transformer = bundle.Transforms.FirstOrDefault(t => t is StyleTransformer); } return((ITransformer)transformer); }
protected BundlerBase(string bundlePath) { BundlePath = bundlePath; if (Debug) { Jstransformer = new NoTransform("text/javascript"); Csstransformer = new NoTransform("text/css"); } else { Jstransformer = new JsMinify(); Csstransformer = new CssMinify(); } }
protected virtual async Task <string> ApplyTransformsAsync(IBundleTransformContext context, IReadOnlyList <IBundleTransform> transforms) { if (transforms != null) { for (int i = 0, n = transforms.Count; i < n; i++) { context.BuildContext.CancellationToken.ThrowIfCancellationRequested(); IBundleTransform transform = transforms[i]; await transform.TransformAsync(context); transform.Transform(context); } } return(context.Content); }
private void Initialize(string virtualPath, BundleList prefixList, List <string> bundleList, BundleList suffixList, IBundleTransform trans = null) { this.isBaseList = false; this.virtualPath = virtualPath; this.bundleFile = new List <string>(); if (prefixList != null) { this.bundleFile.AddRange(prefixList.BundleFile); } if (bundleList != null) { this.bundleFile.AddRange(bundleList); } if (suffixList != null) { this.bundleFile.AddRange(suffixList.BundleFile); } this.trans = trans; }
public static void RegisterBundles(BundleCollection bundles) { var babelTransForm = new IBundleTransform[] { new BabelTransform(), new JsMinify() }; var lessPattern = "*.less"; var jsPattern = "*.js"; var jsxPattern = "*.jsx"; // 全局样式 bundles.Add(new LessBundle("~/g/css").IncludeDirectory("~/Extends/GlobalStyles", lessPattern, true)); // 全局js bundles.Add(new ScriptBundle("~/g/js").IncludeDirectory("~/Extends/CommonJS", jsPattern, true)); // Component js,css 打包 var path = System.Web.HttpContext.Current.Server.MapPath("~/Extends/Components"); DirectoryInfo di = new DirectoryInfo(path); DirectoryInfo[] dirs = di.GetDirectories(); foreach (DirectoryInfo dir in dirs) { var fileName = dir.Name; bundles.Add(new Bundle(string.Format("~/{0}/js", fileName)).IncludeDirectory("~/Extends/Components/" + fileName, jsxPattern, true)); bundles.Add(new LessBundle(string.Format("~/{0}/css", fileName)).IncludeDirectory("~/Extends/Components/" + fileName, lessPattern, true)); } }
public static Bundle WithTransform(this Bundle bundle, IBundleTransform transform) { bundle.Transforms.Add(transform); return bundle; }
/// <summary> /// Initializes a new instance of the <see cref="StyleBundle"/> class. /// </summary> /// <param name="virtualPath">The virtual path used to reference the <see cref="StyleBundle"/> from within a view or Web page.</param> /// <param name="cdnPath">An alternate url for the bundle when it is stored in a content delivery network.</param> /// <param name="transforms">A list of <see cref="System.Web.Optimization.IBundleTransform" /> objects which process the contents of the bundle in the order which they are added.</param> public StyleBundle(string virtualPath, string cdnPath, IBundleTransform transforms) : base(virtualPath, cdnPath, transforms) { base.ConcatenationToken = ";" + Environment.NewLine; }
public BundleList(string virtualPath, BundleList prefixList, string[] bundleList, IBundleTransform trans = null) { Initialize(virtualPath, prefixList, bundleList.ToList(), null, trans); }
public BundleList(string virtualPath, BundleList prefixList, List <string> bundleList, BundleList suffixList, IBundleTransform trans = null) { Initialize(virtualPath, prefixList, bundleList, suffixList, trans); }
// Stolen from @howard_dierking ;) => https://gist.github.com/1998379 public static IBundleTransform Then( this IBundleTransform instance, IBundleTransform then) { return new ChainedBundle(instance, then); }
public ChainedBundle(IBundleTransform instance, IBundleTransform then) { _instance = instance; _then = then; }
public void RemoveTransformationType(Type transformationType) { IBundleTransform transformation = Transforms.First(i => i.GetType().IsAssignableFrom(transformationType)); Transforms?.Remove(transformation); }
private static void SetupBundle(string path, IBundleTransform transform) { var cssBundle = new Bundle(path, transform); cssBundle.AddDirectory("~/Content", "*.less", true); BundleTable.Bundles.Add(cssBundle); }
public static Bundle TransformWith(this Bundle bundle, IBundleTransform transform) { bundle.Transforms.Add(transform); return(bundle); }
private static Bundle CreateLogonJsBundle(IBundleTransform jsTransformer) { Bundle bundle = new Bundle("~/Scripts/Logon/js", jsTransformer); bundle.AddFile("~/Scripts/jquery-1.8.0.js"); bundle.AddFile("~/Scripts/jquery.validate.js"); bundle.AddFile("~/Scripts/jquery.unobtrusive-ajax.js"); bundle.AddFile("~/Scripts/jquery.validate.unobtrusive.js"); bundle.AddFile("~/Scripts/jci.polyfills.js"); return bundle; }
/// <summary> /// バンドル追加 /// </summary> /// <param name="bundles">バンドル一覧</param> /// <param name="bundle">バンドル</param> /// <param name="transform">CacheBusting用</param> private static Bundle AddBundle(BundleCollection bundles, Bundle bundle, IBundleTransform transform) { bundle.Transforms.Add(transform); bundles.Add(bundle); return(bundle); }