DEV Community

Mayank
Mayank

Posted on

Answer: Load different css files based on environment with NextJS

Although @felix Eklöf has recommended a very nice approach by programmatically renaming files. Here's something more simple, suitable, and convenient.

Just import both the styles in your component and depending on the variable from .env file use the one that is needed. Next.js automatically tree-shakes extra classes that are not…

Top comments (0)