Background
- I have two css files - styles.mobile.css and styles.desktop.css
- As the name suggests, I am using two separate css for mobile and desktop views
- I inject css dynamically in index.html based on screen size
- Obviously I can't put them in styles.css
- I have attached folder structure screenshot
Question Is there a way to add hashing to styles.mobile.css and styles.desktop.css when I run ng build --prod
Code to detect device and inject css
private addCss(): void {
if (this.currentDevice === "desktop") {
this.document
.getElementById("theme")
.setAttribute("href", "styles.desktop.css");
} else {
this.document
.getElementById("theme")
.setAttribute("href", "styles.mobile.css");
}
}

index.htmlon how you detect it?style.cssfile. Make a media query and you're good to go.