.NET Core 8 bundling and minifying with WebOptimizer

206 views Asked by At

I'm starting to work with ASP.NET Core 8 (MVC with Razor), and I'm getting this b-omgphq2ymd "tag" added to my HTML elements. What is this? What's the purpose?

From this:

<button class="button-menu-mobile open-left waves-light waves-effect" id="btnAction1">
    <i class="dripicons-menu"></i>
</button>

To this:

<button b-omgphq2ymd="" class="button-menu-mobile open-left waves-light waves-effect" id="btnAction1">
    <i b-omgphq2ymd="" class="dripicons-menu"></i>
</button>

At Program.cs I'm starting builder.Services.AddWebOptimizer(); with no special settings.

1

There are 1 answers

0
Jason Pan On BEST ANSWER

This is CSS isolation, and here is the official document: ASP.NET Core Blazor CSS isolation.

It's a new feature from .NET 6. If you don't want this, you can disable it by modifying the .csproj file like below.

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    // Add this to disable it
    <ScopedCssEnabled>false</ScopedCssEnabled>
  </PropertyGroup>

</Project>