Search code examples
asp.net-core.net-coreblazorstatic-filesblazor-webassembly

How to rename bundled static files(ProjectName.style.css and blazor.server.js) in The Blazor App


I wanna hide that i use The Blazor.

so, I should modify name of bundled css and js files.

How to do this?


Solution

  • According to this article, CSS isolation occurs at build time. During this process, Blazor rewrites CSS selectors to match markup rendered by the component. These rewritten CSS styles are bundled and produced as a static asset at {PROJECT NAME}.styles.css, where the placeholder {PROJECT NAME} is the referenced package or product name.

    That means we could only disable the bundle not modify it during develop environment.

    But after publish, it will generate the file like this:

    enter image description here

    You could modify the {PROJECT NAME}.styles.css to {other}.styles.css and modify the index.html css name as below:

    <link href="{other}.styles.css" rel="stylesheet" />