bundling improvements.

- Read bundling parameters from appsettings.json
- Implement exclude from bundle feature.
pull/7686/head
Ilkay Ilknur 5 years ago
parent b57ccff441
commit 4699927798

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

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

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

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

@ -0,0 +1,12 @@
using System.Collections.Generic;
using Volo.Abp.Bundling;
namespace Volo.Abp.Cli.Bundling
{
public class BundleConfig
{
public BundlingMode Mode { get; set; }
public string Name { get; set; }
public BundleParameterDictionary Parameters { get; set; }
}
}

@ -1,5 +1,6 @@
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
@ -13,12 +14,13 @@ namespace Volo.Abp.Cli.Bundling
{
public abstract class BundlerBase : IBundler, ITransientDependency
{
private static string[] _minFileSuffixes = { "min", "prod" };
private static string[] _minFileSuffixes = {"min", "prod"};
protected IMinifier Minifier { get; }
public ILogger<BundlerBase> Logger { get; set; }
public abstract string FileExtension { get; }
public abstract string GenerateDefinition(string bundleFilePath);
public abstract string GenerateDefinition(string bundleFilePath,
List<BundleDefinition> bundleDefinitionsExcludingFromBundle);
protected BundlerBase(IMinifier minifier)
{
@ -27,11 +29,15 @@ namespace Volo.Abp.Cli.Bundling
public string Bundle(BundleOptions options, BundleContext context)
{
var bundleFilePath = Path.Combine(PathHelper.GetWwwRootPath(options.Directory), $"{options.BundleName}{FileExtension}");
var bundledContent = BundleFiles(options, context);
var bundleFilePath = Path.Combine(PathHelper.GetWwwRootPath(options.Directory),
$"{options.BundleName}{FileExtension}");
var bundleFileDefinitions = context.BundleDefinitions.Where(t => t.ExcludeFromBundle == false).ToList();
var fileDefinitionsExcludingFromBundle = context.BundleDefinitions.Where(t => t.ExcludeFromBundle).ToList();
var bundledContent = BundleFiles(options, bundleFileDefinitions);
File.WriteAllText(bundleFilePath, bundledContent);
return GenerateDefinition(bundleFilePath);
return GenerateDefinition(bundleFilePath,fileDefinitionsExcludingFromBundle);
}
private bool IsMinFile(string fileName)
@ -47,34 +53,40 @@ namespace Volo.Abp.Cli.Bundling
return false;
}
private string BundleFiles(BundleOptions options, BundleContext context)
private string BundleFiles(BundleOptions options, List<BundleDefinition> bundleDefinitions)
{
var staticAssetsFilePath = Path.Combine(options.Directory, "bin", "Debug", options.FrameworkVersion, $"{options.ProjectFileName}.StaticWebAssets.xml");
var staticAssetsFilePath = Path.Combine(options.Directory, "bin", "Debug", options.FrameworkVersion,
$"{options.ProjectFileName}.StaticWebAssets.xml");
if (!File.Exists(staticAssetsFilePath))
{
throw new BundlingException("Unable to find static web assets file. You need to build the project to generate static web assets file.");
throw new BundlingException(
"Unable to find static web assets file. You need to build the project to generate static web assets file.");
}
var staticAssetsDefinitions = new XmlDocument();
staticAssetsDefinitions.Load(staticAssetsFilePath);
var builder = new StringBuilder();
foreach (var definition in context.BundleDefinitions)
foreach (var definition in bundleDefinitions)
{
string content;
if (definition.Source.StartsWith("_content"))
{
var pathFragments = definition.Source.Split('/').ToList();
var basePath = $"{pathFragments[0]}/{pathFragments[1]}";
var path = staticAssetsDefinitions.SelectSingleNode($"//ContentRoot[@BasePath='{basePath}']").Attributes["Path"].Value;
var path = staticAssetsDefinitions.SelectSingleNode($"//ContentRoot[@BasePath='{basePath}']")
.Attributes["Path"].Value;
var absolutePath = definition.Source.Replace(basePath, path);
content = GetFileContent(absolutePath, options.Minify);
}
else if (definition.Source.StartsWith("_framework"))
{
var slashIndex = definition.Source.IndexOf('/');
var fileName = definition.Source.Substring(slashIndex + 1, definition.Source.Length - slashIndex - 1);
var filePath = Path.Combine(PathHelper.GetFrameworkFolderPath(options.Directory, options.FrameworkVersion), fileName);
var fileName =
definition.Source.Substring(slashIndex + 1, definition.Source.Length - slashIndex - 1);
var filePath =
Path.Combine(PathHelper.GetFrameworkFolderPath(options.Directory, options.FrameworkVersion),
fileName);
content = GetFileContent(filePath, false);
}
else
@ -83,7 +95,8 @@ namespace Volo.Abp.Cli.Bundling
content = GetFileContent(filePath, options.Minify);
}
content = ProcessBeforeAddingToTheBundle(definition.Source, Path.Combine(options.Directory, "wwwroot"), content);
content = ProcessBeforeAddingToTheBundle(definition.Source, Path.Combine(options.Directory, "wwwroot"),
content);
builder.AppendLine(content);
}
@ -101,16 +114,19 @@ namespace Volo.Abp.Cli.Bundling
}
catch (NUglifyException ex)
{
Logger.LogWarning($"Unable to minify the file: {Path.GetFileName(filePath)}. Adding file to the bundle without minification.", ex);
Logger.LogWarning(
$"Unable to minify the file: {Path.GetFileName(filePath)}. Adding file to the bundle without minification.",
ex);
}
}
return content;
}
protected virtual string ProcessBeforeAddingToTheBundle(string referencePath, string bundleDirectory, string fileContent)
protected virtual string ProcessBeforeAddingToTheBundle(string referencePath, string bundleDirectory,
string fileContent)
{
return fileContent;
}
}
}
}

@ -0,0 +1,9 @@
namespace Volo.Abp.Cli.Bundling
{
public enum BundlingMode
{
None,
Bundle,
BundleAndMinify,
}
}

@ -11,6 +11,7 @@ using Volo.Abp.Bundling;
using Volo.Abp.Cli.Build;
using Volo.Abp.Cli.Bundling.Scripts;
using Volo.Abp.Cli.Bundling.Styles;
using Volo.Abp.Cli.Configuration;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Minify.Scripts;
using Volo.Abp.Minify.Styles;
@ -26,17 +27,27 @@ namespace Volo.Abp.Cli.Bundling
public ILogger<BundlingService> Logger { get; set; }
public IScriptBundler ScriptBundler { get; set; }
public IStyleBundler StyleBundler { get; set; }
public IConfigReader ConfigReader { get; set; }
public async Task BundleAsync(string directory, bool forceBuild, bool bundle, bool minify, string bundleName)
public async Task BundleAsync(string directory, bool forceBuild)
{
var projectFiles = Directory.GetFiles(directory, "*.csproj");
if (!projectFiles.Any())
{
throw new BundlingException("No project file found in the directory. The working directory must have a Blazor project file.");
throw new BundlingException(
"No project file found in the directory. The working directory must have a Blazor project file.");
}
var projectFilePath = projectFiles[0];
var config = ConfigReader.Read(PathHelper.GetWwwRootPath(directory));
var bundleConfig = config?.Bundle;
if (bundleConfig == null)
{
throw new BundlingException("Bundle section is missing in the appsettings.json configuration file.");
}
if (forceBuild)
{
var projects = new List<DotNetProjectInfo>()
@ -56,20 +67,20 @@ namespace Volo.Abp.Cli.Bundling
FindBundleContributorsRecursively(startupModule, 0, bundleDefinitions);
bundleDefinitions = bundleDefinitions.OrderByDescending(t => t.Level).ToList();
var styleContext = GetStyleContext(bundleDefinitions);
var scriptContext = GetScriptContext(bundleDefinitions);
var styleContext = GetStyleContext(bundleDefinitions,bundleConfig.Parameters);
var scriptContext = GetScriptContext(bundleDefinitions,bundleConfig.Parameters);
string styleDefinitions;
string scriptDefinitions;
if (bundle || minify)
if (bundleConfig.Mode is BundlingMode.Bundle || bundleConfig.Mode is BundlingMode.BundleAndMinify)
{
var options = new BundleOptions
{
Directory = directory,
FrameworkVersion = frameworkVersion,
ProjectFileName = projectName,
BundleName = bundleName,
Minify = minify
BundleName = bundleConfig.Name,
Minify = bundleConfig.Mode == BundlingMode.BundleAndMinify
};
styleDefinitions = StyleBundler.Bundle(options, styleContext);
@ -84,34 +95,37 @@ namespace Volo.Abp.Cli.Bundling
await UpdateDependenciesInHtmlFileAsync(directory, styleDefinitions, scriptDefinitions);
}
private BundleContext GetScriptContext(List<BundleTypeDefinition> bundleDefinitions)
private BundleContext GetScriptContext(List<BundleTypeDefinition> bundleDefinitions,
BundleParameterDictionary parameters)
{
var scriptContext = new BundleContext();
foreach (var bundleDefinition in bundleDefinitions)
{
var contributor = CreateContributorInstance(bundleDefinition.BundleContributorType);
contributor.AddScripts(scriptContext);
contributor.AddScripts(scriptContext, parameters);
}
scriptContext.Add("_framework/blazor.webassembly.js");
return scriptContext;
}
private BundleContext GetStyleContext(List<BundleTypeDefinition> bundleDefinitions)
private BundleContext GetStyleContext(List<BundleTypeDefinition> bundleDefinitions,
BundleParameterDictionary parameters)
{
var styleContext = new BundleContext();
foreach (var bundleDefinition in bundleDefinitions)
{
var contributor = CreateContributorInstance(bundleDefinition.BundleContributorType);
contributor.AddStyles(styleContext);
contributor.AddStyles(styleContext, parameters);
}
return styleContext;
}
private async Task UpdateDependenciesInHtmlFileAsync(string directory, string styleDefinitions, string scriptDefinitions)
private async Task UpdateDependenciesInHtmlFileAsync(string directory, string styleDefinitions,
string scriptDefinitions)
{
var htmlFilePath = Path.Combine(PathHelper.GetWwwRootPath(directory), "index.html");
if (!File.Exists(htmlFilePath))
@ -127,8 +141,10 @@ namespace Volo.Abp.Cli.Bundling
content = await reader.ReadToEndAsync();
}
content = UpdatePlaceholders(content, BundlingConsts.StylePlaceholderStart, BundlingConsts.StylePlaceholderEnd, styleDefinitions);
content = UpdatePlaceholders(content, BundlingConsts.ScriptPlaceholderStart, BundlingConsts.ScriptPlaceholderEnd, scriptDefinitions);
content = UpdatePlaceholders(content, BundlingConsts.StylePlaceholderStart,
BundlingConsts.StylePlaceholderEnd, styleDefinitions);
content = UpdatePlaceholders(content, BundlingConsts.ScriptPlaceholderStart,
BundlingConsts.ScriptPlaceholderEnd, scriptDefinitions);
using (var writer = new StreamWriter(htmlFilePath, false, fileEncoding))
{
@ -137,11 +153,13 @@ namespace Volo.Abp.Cli.Bundling
}
}
private string UpdatePlaceholders(string content, string placeholderStart, string placeholderEnd, string definitions)
private string UpdatePlaceholders(string content, string placeholderStart, string placeholderEnd,
string definitions)
{
var placeholderStartIndex = content.IndexOf(placeholderStart);
var placeholderEndIndex = content.IndexOf(placeholderEnd);
var updatedContent = content.Remove(placeholderStartIndex, (placeholderEndIndex + placeholderEnd.Length) - placeholderStartIndex);
var updatedContent = content.Remove(placeholderStartIndex,
(placeholderEndIndex + placeholderEnd.Length) - placeholderStartIndex);
return updatedContent.Insert(placeholderStartIndex, definitions);
}
@ -179,8 +197,10 @@ namespace Volo.Abp.Cli.Bundling
{
builder.Append($"{additionalProperty.Key}={additionalProperty.Value} ");
}
builder.AppendLine("></script>");
}
builder.Append($" {BundlingConsts.ScriptPlaceholderEnd}");
return builder.ToString();
@ -188,7 +208,7 @@ namespace Volo.Abp.Cli.Bundling
private IBundleContributor CreateContributorInstance(Type bundleContributorType)
{
return (IBundleContributor)Activator.CreateInstance(bundleContributorType);
return (IBundleContributor) Activator.CreateInstance(bundleContributorType);
}
private void FindBundleContributorsRecursively(
@ -203,7 +223,8 @@ namespace Volo.Abp.Cli.Bundling
if (bundleContributors.Count > 1)
{
throw new BundlingException($"Each project must contain only one class implementing {nameof(IBundleContributor)}");
throw new BundlingException(
$"Each project must contain only one class implementing {nameof(IBundleContributor)}");
}
if (bundleContributors.Any())
@ -255,10 +276,11 @@ namespace Volo.Abp.Cli.Bundling
var sdk = document.DocumentElement.GetAttribute("Sdk");
if (sdk != BundlingConsts.SupportedWebAssemblyProjectType)
{
throw new BundlingException($"Unsupported project type. Project type must be {BundlingConsts.SupportedWebAssemblyProjectType}.");
throw new BundlingException(
$"Unsupported project type. Project type must be {BundlingConsts.SupportedWebAssemblyProjectType}.");
}
return document.SelectSingleNode("//TargetFramework").InnerText;
}
}
}
}

@ -4,6 +4,6 @@ namespace Volo.Abp.Cli.Bundling
{
public interface IBundlingService
{
Task BundleAsync(string directory, bool forceBuild, bool bundle, bool minify, string bundleName);
Task BundleAsync(string directory, bool forceBuild);
}
}

@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Volo.Abp.Bundling;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Minify.Scripts;
@ -13,22 +15,36 @@ namespace Volo.Abp.Cli.Bundling.Scripts
public ScriptBundler(IJavascriptMinifier minifier)
: base(minifier)
{
}
public override string GenerateDefinition(string bundleFilePath)
public override string GenerateDefinition(string bundleFilePath,
List<BundleDefinition> bundleDefinitionsExcludingFromBundle)
{
var lastModifiedTicks = File.GetLastWriteTime(bundleFilePath).Ticks;
var builder = new StringBuilder();
builder.AppendLine($"{BundlingConsts.ScriptPlaceholderStart}");
builder.AppendLine($" <script src=\"{Path.GetFileName(bundleFilePath)}?_v={lastModifiedTicks}\"></script>");
builder.AppendLine(
$" <script src=\"{Path.GetFileName(bundleFilePath)}?_v={lastModifiedTicks}\"></script>");
foreach (var bundleDefinition in bundleDefinitionsExcludingFromBundle)
{
builder.Append($" <script src=\"{bundleDefinition.Source}\"");
foreach (var additionalProperty in bundleDefinition.AdditionalProperties)
{
builder.Append($" {additionalProperty.Key}={additionalProperty.Value} ");
}
builder.AppendLine("></script>");
}
builder.Append($" {BundlingConsts.ScriptPlaceholderEnd}");
return builder.ToString();
}
protected override string ProcessBeforeAddingToTheBundle(string referencePath, string bundleDirectory, string fileContent)
protected override string ProcessBeforeAddingToTheBundle(string referencePath, string bundleDirectory,
string fileContent)
{
return fileContent.EnsureEndsWith(';') + Environment.NewLine;
}
}
}
}

@ -1,5 +1,7 @@
using System.IO;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Volo.Abp.Bundling;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Minify.Styles;
@ -12,26 +14,41 @@ namespace Volo.Abp.Cli.Bundling.Styles
public StyleBundler(ICssMinifier minifier)
: base(minifier)
{
}
public override string GenerateDefinition(string bundleFilePath)
public override string GenerateDefinition(string bundleFilePath,
List<BundleDefinition> bundleDefinitionsExcludingFromBundle)
{
var lastModifiedTicks = File.GetLastWriteTime(bundleFilePath).Ticks;
var builder = new StringBuilder();
builder.AppendLine($"{BundlingConsts.StylePlaceholderStart}");
builder.AppendLine($" <link href=\"{Path.GetFileName(bundleFilePath)}?_v={lastModifiedTicks}\" rel=\"stylesheet\"/>");
builder.AppendLine(
$" <link href=\"{Path.GetFileName(bundleFilePath)}?_v={lastModifiedTicks}\" rel=\"stylesheet\"/>");
foreach (var bundleDefinition in bundleDefinitionsExcludingFromBundle)
{
builder.Append($" <link href=\"{bundleDefinition.Source}\" rel=\"stylesheet\"");
foreach (var additionalProperty in bundleDefinition.AdditionalProperties)
{
builder.Append($" {additionalProperty.Key}={additionalProperty.Value} ");
}
builder.AppendLine("/>");
}
builder.Append($" {BundlingConsts.StylePlaceholderEnd}");
return builder.ToString();
}
protected override string ProcessBeforeAddingToTheBundle(string referencePath, string bundleDirectory, string fileContent)
protected override string ProcessBeforeAddingToTheBundle(string referencePath, string bundleDirectory,
string fileContent)
{
return CssRelativePathAdjuster.Adjust(
fileContent,
referencePath,
bundleDirectory
);
fileContent,
referencePath,
bundleDirectory
);
}
}
}
}

@ -27,26 +27,7 @@ namespace Volo.Abp.Cli.Commands
var forceBuild = commandLineArgs.Options.ContainsKey(Options.ForceBuild.Short) ||
commandLineArgs.Options.ContainsKey(Options.ForceBuild.Long);
var bundle = commandLineArgs.Options.ContainsKey(Options.Bundle.Short) ||
commandLineArgs.Options.ContainsKey(Options.Bundle.Long);
var minify = commandLineArgs.Options.ContainsKey(Options.Minify.Short) ||
commandLineArgs.Options.ContainsKey(Options.Minify.Long);
var name = commandLineArgs.Options.GetOrNull(
Options.Name.Short,
Options.Name.Long
);
if ((minify || bundle) && name.IsNullOrEmpty())
{
throw new CliUsageException(
"Please specify a bundle name." +
Environment.NewLine + Environment.NewLine +
GetUsageInfo()
);
}
if (!Directory.Exists(workingDirectory))
{
@ -59,7 +40,7 @@ namespace Volo.Abp.Cli.Commands
try
{
await BundlingService.BundleAsync(workingDirectory, forceBuild, bundle, minify, name);
await BundlingService.BundleAsync(workingDirectory, forceBuild);
}
catch (BundlingException ex)
{
@ -85,10 +66,6 @@ namespace Volo.Abp.Cli.Commands
sb.AppendLine("");
sb.AppendLine("-wd|--working-directory <directory-path> (default: empty)");
sb.AppendLine("-f | --force (default: false)");
sb.AppendLine("-f | --force (default: false)");
sb.AppendLine("-b | --bundle (default: false)");
sb.AppendLine("-m | --minify (default: false)");
sb.AppendLine("-n | --name (default: empty)");
sb.AppendLine("");
sb.AppendLine("See the documentation for more info: https://docs.abp.io/en/abp/latest/CLI");
@ -108,24 +85,6 @@ namespace Volo.Abp.Cli.Commands
public const string Short = "f";
public const string Long = "force";
}
public static class Bundle
{
public const string Short = "b";
public const string Long = "bundle";
}
public static class Minify
{
public const string Short = "m";
public const string Long = "minify";
}
public static class Name
{
public const string Short = "n";
public const string Long = "name";
}
}
}
}

@ -0,0 +1,9 @@
using Volo.Abp.Cli.Bundling;
namespace Volo.Abp.Cli.Configuration
{
public class AbpCliConfig
{
public BundleConfig Bundle { get; set; }
}
}

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.Cli.Configuration
{
public class ConfigReader : IConfigReader, ITransientDependency
{
const string appSettingFileName = "appsettings.json";
public AbpCliConfig Read(string directory)
{
var settingsFilePath = Path.Combine(directory, appSettingFileName);
if (!File.Exists(settingsFilePath))
{
throw new Exception();
}
var settingsFileContent = File.ReadAllText(settingsFilePath);
using (var document = JsonDocument.Parse(settingsFileContent))
{
var element = document.RootElement.GetProperty("AbpCli");
var configText = element.GetRawText();
var options = new JsonSerializerOptions
{
Converters =
{
new JsonStringEnumConverter()
}
};
return JsonSerializer.Deserialize<AbpCliConfig>(configText,options);
}
}
}
}

@ -0,0 +1,9 @@
using System.Threading.Tasks;
namespace Volo.Abp.Cli.Configuration
{
public interface IConfigReader
{
AbpCliConfig Read(string directory);
}
}

@ -11,11 +11,13 @@ namespace Volo.Abp.Bundling
BundleDefinitions = new List<BundleDefinition>();
}
public void Add(string source, Dictionary<string, string> additionalProperties = null)
public void Add(string source, bool excludeFromBundle = false,
Dictionary<string, string> additionalProperties = null)
{
var bundleDefinition = new BundleDefinition
{
Source = source,
ExcludeFromBundle = excludeFromBundle
};
if (additionalProperties != null)
@ -23,7 +25,8 @@ namespace Volo.Abp.Bundling
bundleDefinition.AdditionalProperties = additionalProperties;
}
BundleDefinitions.AddIfNotContains((item) => item.Source == bundleDefinition.Source, () => bundleDefinition);
BundleDefinitions.AddIfNotContains((item) => item.Source == bundleDefinition.Source,
() => bundleDefinition);
}
}
}
}

@ -8,6 +8,8 @@ namespace Volo.Abp.Bundling
public Dictionary<string, string> AdditionalProperties { get; set; }
public bool ExcludeFromBundle { get; set; }
public BundleDefinition()
{
AdditionalProperties = new Dictionary<string, string>();

@ -0,0 +1,8 @@
using System.Collections.Generic;
namespace Volo.Abp.Bundling
{
public class BundleParameterDictionary : Dictionary<string, string>
{
}
}

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

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

@ -4,11 +4,11 @@ namespace MyCompanyName.MyProjectName.Blazor
{
public class MyProjectNameBundleContributor : IBundleContributor
{
public void AddScripts(BundleContext context)
public void AddScripts(BundleContext context, BundleParameterDictionary parameters)
{
}
public void AddStyles(BundleContext context)
public void AddStyles(BundleContext context, BundleParameterDictionary parameters)
{
context.Add("main.css");
}

Loading…
Cancel
Save