Browse Source

put bundle parameters inside bundle context.

pull/6668/head
Ilkay Ilknur 6 years ago
parent
commit
e93697a42d
  1. 4
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/BasicThemeBundleContributor.cs
  2. 4
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/ThemingBundleContributor.cs
  3. 4
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ComponentsWebAssemblyBundleContributor.cs
  4. 4
      framework/src/Volo.Abp.BlazoriseUI/BlazoriseUIBundleContributor.cs
  5. 16
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs
  6. 4
      framework/src/Volo.Abp.Core/Volo/Abp/Bundling/BundleContext.cs
  7. 4
      framework/src/Volo.Abp.Core/Volo/Abp/Bundling/IBundleContributor.cs
  8. 4
      framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo/Abp/Http/Client/IdentityModel/WebAssembly/IdentityModelWebAssemblyBundleContributor.cs

4
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/BasicThemeBundleContributor.cs

@ -4,12 +4,12 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme
{ {
public class BasicThemeBundleContributor : IBundleContributor public class BasicThemeBundleContributor : IBundleContributor
{ {
public void AddScripts(BundleContext context, BundleParameterDictionary parameters) public void AddScripts(BundleContext context)
{ {
} }
public void AddStyles(BundleContext context, BundleParameterDictionary parameters) public void AddStyles(BundleContext context)
{ {
context.Add("_content/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/libs/abp/css/theme.css"); context.Add("_content/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/libs/abp/css/theme.css");
} }

4
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/ThemingBundleContributor.cs

@ -4,12 +4,12 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly.Theming
{ {
public class ThemingBundleContributor : IBundleContributor public class ThemingBundleContributor : IBundleContributor
{ {
public void AddScripts(BundleContext context, BundleParameterDictionary parameters) public void AddScripts(BundleContext context)
{ {
} }
public void AddStyles(BundleContext context, BundleParameterDictionary parameters) public void AddStyles(BundleContext context)
{ {
context.BundleDefinitions.Insert(0, new BundleDefinition context.BundleDefinitions.Insert(0, new BundleDefinition
{ {

4
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ComponentsWebAssemblyBundleContributor.cs

@ -4,12 +4,12 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly
{ {
public class ComponentsWebAssemblyBundleContributor : IBundleContributor public class ComponentsWebAssemblyBundleContributor : IBundleContributor
{ {
public void AddScripts(BundleContext context, BundleParameterDictionary parameters) public void AddScripts(BundleContext context)
{ {
context.Add("_content/Volo.Abp.AspNetCore.Components.WebAssembly/libs/abp/js/abp.js"); context.Add("_content/Volo.Abp.AspNetCore.Components.WebAssembly/libs/abp/js/abp.js");
} }
public void AddStyles(BundleContext context, BundleParameterDictionary parameters) public void AddStyles(BundleContext context)
{ {
} }

4
framework/src/Volo.Abp.BlazoriseUI/BlazoriseUIBundleContributor.cs

@ -4,13 +4,13 @@ namespace Volo.Abp.BlazoriseUI
{ {
public class BlazoriseUIBundleContributor : IBundleContributor public class BlazoriseUIBundleContributor : IBundleContributor
{ {
public void AddScripts(BundleContext context, BundleParameterDictionary parameters) public void AddScripts(BundleContext context)
{ {
context.Add("_content/Blazorise/blazorise.js"); context.Add("_content/Blazorise/blazorise.js");
context.Add("_content/Blazorise.Bootstrap/blazorise.bootstrap.js"); context.Add("_content/Blazorise.Bootstrap/blazorise.bootstrap.js");
} }
public void AddStyles(BundleContext context, BundleParameterDictionary parameters) public void AddStyles(BundleContext context)
{ {
context.Add("_content/Blazorise/blazorise.css"); context.Add("_content/Blazorise/blazorise.css");
context.Add("_content/Blazorise.Bootstrap/blazorise.bootstrap.css"); context.Add("_content/Blazorise.Bootstrap/blazorise.bootstrap.css");

16
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs

@ -79,7 +79,7 @@ namespace Volo.Abp.Cli.Bundling
Directory = directory, Directory = directory,
FrameworkVersion = frameworkVersion, FrameworkVersion = frameworkVersion,
ProjectFileName = projectName, ProjectFileName = projectName,
BundleName = bundleConfig.Name, BundleName = bundleConfig.Name.IsNullOrEmpty() ? "global" : bundleConfig.Name,
Minify = bundleConfig.Mode == BundlingMode.BundleAndMinify Minify = bundleConfig.Mode == BundlingMode.BundleAndMinify
}; };
@ -98,12 +98,15 @@ namespace Volo.Abp.Cli.Bundling
private BundleContext GetScriptContext(List<BundleTypeDefinition> bundleDefinitions, private BundleContext GetScriptContext(List<BundleTypeDefinition> bundleDefinitions,
BundleParameterDictionary parameters) BundleParameterDictionary parameters)
{ {
var scriptContext = new BundleContext(); var scriptContext = new BundleContext
{
Parameters = parameters
};
foreach (var bundleDefinition in bundleDefinitions) foreach (var bundleDefinition in bundleDefinitions)
{ {
var contributor = CreateContributorInstance(bundleDefinition.BundleContributorType); var contributor = CreateContributorInstance(bundleDefinition.BundleContributorType);
contributor.AddScripts(scriptContext, parameters); contributor.AddScripts(scriptContext);
} }
scriptContext.Add("_framework/blazor.webassembly.js"); scriptContext.Add("_framework/blazor.webassembly.js");
@ -113,12 +116,15 @@ namespace Volo.Abp.Cli.Bundling
private BundleContext GetStyleContext(List<BundleTypeDefinition> bundleDefinitions, private BundleContext GetStyleContext(List<BundleTypeDefinition> bundleDefinitions,
BundleParameterDictionary parameters) BundleParameterDictionary parameters)
{ {
var styleContext = new BundleContext(); var styleContext = new BundleContext
{
Parameters = parameters
};
foreach (var bundleDefinition in bundleDefinitions) foreach (var bundleDefinition in bundleDefinitions)
{ {
var contributor = CreateContributorInstance(bundleDefinition.BundleContributorType); var contributor = CreateContributorInstance(bundleDefinition.BundleContributorType);
contributor.AddStyles(styleContext, parameters); contributor.AddStyles(styleContext);
} }
return styleContext; return styleContext;

4
framework/src/Volo.Abp.Core/Volo/Abp/Bundling/BundleContext.cs

@ -5,10 +5,12 @@ namespace Volo.Abp.Bundling
public class BundleContext public class BundleContext
{ {
public List<BundleDefinition> BundleDefinitions { get; set; } public List<BundleDefinition> BundleDefinitions { get; set; }
public BundleParameterDictionary Parameters { get; set; }
public BundleContext() public BundleContext()
{ {
BundleDefinitions = new List<BundleDefinition>(); BundleDefinitions = new List<BundleDefinition>();
Parameters = new BundleParameterDictionary();
} }
public void Add(string source, bool excludeFromBundle = false, public void Add(string source, bool excludeFromBundle = false,

4
framework/src/Volo.Abp.Core/Volo/Abp/Bundling/IBundleContributor.cs

@ -2,7 +2,7 @@
{ {
public interface IBundleContributor public interface IBundleContributor
{ {
void AddScripts(BundleContext context, BundleParameterDictionary parameters); void AddScripts(BundleContext context);
void AddStyles(BundleContext context, BundleParameterDictionary parameters); void AddStyles(BundleContext context);
} }
} }

4
framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo/Abp/Http/Client/IdentityModel/WebAssembly/IdentityModelWebAssemblyBundleContributor.cs

@ -4,12 +4,12 @@ namespace Volo.Abp.Http.Client.IdentityModel.WebAssembly
{ {
public class IdentityModelWebAssemblyBundleContributor : IBundleContributor public class IdentityModelWebAssemblyBundleContributor : IBundleContributor
{ {
public void AddScripts(BundleContext context, BundleParameterDictionary parameters) public void AddScripts(BundleContext context)
{ {
context.Add("_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js"); context.Add("_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js");
} }
public void AddStyles(BundleContext context, BundleParameterDictionary parameters) public void AddStyles(BundleContext context)
{ {
} }

Loading…
Cancel
Save