v0.7.0
Pre-release
Pre-release
- Use config file instead of replacing tokens in JavaScript files
- Script assets are now included as static web assets/RCL assets instead of linked files
- Fix error when resolving XML static web asset path that contains relative path (i.e. basepath/../filepath)
- Update JsBind.Net from v0.1.4 to v0.2.5 and WebExtensions.Net from v0.9.0 to v0.9.2
Breaking changes:
- MsBuild property LinkBrowserExtensionAssetsPath is removed
- Projects with content script need to use
app.js
pre-initialization script - Option is removed from the service dependency registration
- Path to
ContentScript.js
andCore.js
is changed from "BrowserExtensionScripts" to "content/Blazor.BrowserExtension" - Global variable in JavaScript to change initialization behaviour is now within the "BlazorBrowserExtension" object
Migration Guide:
-
Update
Program.cs
to remove the configuration action in the.AddBrowserExtensionServices()
parameter// Before builder.Services.AddBrowserExtensionServices(options => { options.ProjectNamespace = typeof(Program).Namespace; }); // After builder.Services.AddBrowserExtensionServices();
-
Update
index.html
andmanifest.json
and anywhere with reference to the scripts from this package from "BrowserExtensionScripts/" to "content/Blazor.BrowserExtension/"<!-- Before --> <script src="BrowserExtensionScripts/Core.js"></script> <!-- After --> <script src="content/Blazor.BrowserExtension/Core.js"></script>
-
"BrowserExtensionScripts/*" can be removed from the
web_accessible_resources
key inmanifest.json
Projects with content scripts
- Add a new file named
app.js
under the directorywwwroot
- Add the following code into the new file.
if (globalThis.BlazorBrowserExtension.BrowserExtension.Mode === globalThis.BlazorBrowserExtension.Modes.ContentScript) { const appDiv = document.createElement("div"); appDiv.id = "My_Unique_Extension_App_Id"; // this ID should be the same as the container ID in the index.html file document.body.appendChild(appDiv); }
- Add "app.js" to the
web_accessible_resources
key inmanifest.json
Projects with custom initialization behaviour
Move the initialization logic into app.js
file. Refer to the readme to read on the way to change initialization behaviour in this version.