1

Is there a way to remove the unused CSS imported from semantic-ui-css/semantic.min.css?

Checking the Coverage tab in Developer Tools, it seems that this file contains 97.8% unused bytes.

Coverage tab image below: enter image description here

2
  • 1
    You could use a tool like PurgeCSS in your build process to remove the unused CSS - purgecss.com Commented Aug 26, 2020 at 10:15
  • I tried to use PurgeCSS but it doesn't work Commented Nov 29, 2020 at 9:35

1 Answer 1

1

I fixed this by importing just the minified CSS file for a specific Component instead of importing the entire framework.

Sign up to request clarification or add additional context in comments.

2 Comments

Hi there! Can you explain what you mean? I ask because isn’t the .min file, still just the entire library?
Hello! This is how I did it: import { Button, Form } from "semantic-ui-react"; import "semantic-ui-css/components/button.min.css"; import "semantic-ui-css/components/form.min.css"; In this way you only import the related CSS classes for each component.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.