Is minifying of CSS classes names across the razor files, css files and c# files possible?

10 hours ago 1
ARTICLE AD BOX

For HTML/CSS/JavaScript-based stack, the gulp-minify-cssnames Gulp plugin is available. As far as I have checked the source code, this magic is simply the replacing of CSS classes names with specific prefixes by the regular expression acoross the HTML/CSS/JavaScript files. For example,

<div class="menu--s--" id="main-menu--s--"> <div class="menu__item--s--">1</div> <div class="menu__item--s--">2</div> <div class="menu__item--s-- .menu__item_active--s--">3</div> </div> .menu--s-- {color: red;} .menu_top--s-- {color: black;} .menu__item--s-- {color: green;} .menu__item_active--s-- {color: blue;} .menu__item_active--s--::before {content: 'active'} var $menuItems = document.querySelectorAll('.menu__item--s--'); var $mainMenu = document.querySelector('#main-menu--s--');

will be turned to:

<div class="a0" id="a4"> <div class="a2">1</div> <div class="a2">2</div> <div class="a2 a3">3</div> </div> .a0 {color: red;} .a1 {color: black;} .a2 {color: green;} .a3 {color: blue;} .a3::before {content: 'active'} var $menuItems = document.querySelectorAll('.a2'); var $mainMenu = document.querySelector('#a4');

Is same thing possible for C#/Blazor stack? Please note that I don't ask "Are there some similar tools for C#/Blazor?" - I am asking is this theoretically possible or no. If it is theoretically possible maybe I can implement it myself.

Besides the C#/.NET I am specialized on Pug/Stylus/TypeScript stack. In this case, the post-processing of output HTML/CSS/JavaScript is required, and the usage of the CSS classes names regular expression is not the only approach (I suppose, it is the even dangerous approach). But what about C#/Blazor? Into what the .razor and .cs (possibly referring to some CSS class name) will be turned?

Read Entire Article