Detecting unused CSS


Recently I migrated from Ionic v3 to v4 and due to Shadow DOM and other things lots of my CSS will need to be rebuilt.

Also, on v3 I had lots of unused CSS definitions inside the SCSS file which I wanted to be able to detect and remove to reduce the file size and make it more readable.

Is there a way to detect unused SCSS definitions during build process in order to remove them?