We don’t alter the original file, we simply swap the Semantic UI entry point with one of our own which “tells” webpack the components of which the CSS should be produced.

If you are using CSS Modules then what you’ re saying could be the way to go, by explicitly default-importing the LESS declarations of each component in the corresponding JS file. You should also be careful about duplicate declarations.

If you’ re not using CSS modules and you simply want to import the LESS declarations of the specific component that you’ ll be using, then what i’m proposing does the exact same thing a bit more organized and “Semantic-y”.

Front-end ReactJS Developer — https://aggelos.dev

Front-end ReactJS Developer — https://aggelos.dev