Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
March 24, 2022 05:50 am GMT

Reduce Duplicated Styled Components? Check Here

I made a post 2 weeks ago about how to reduce CSS automatically: Scan Duplicated & Similar CSS and the github source: css-checker

Few days ago, there was an issue asking for styled components support. It's very hard to found few sources about processing styled components using golang, so I have to use regex to detect them and use original css-checker functions to detect diffs in styled-components.

Fortunately, it goes well to use css-checker for styled-components checking and you can use this now for styled-components check. It can check similar lines and prints those blocks with diff lines highlighted.

Install

  • You can access to the package via go install:
go install github.com/ruilisi/css-checker@latest

(With go version before 1.17, use go get github.com/ruilisi/css-checker). Or download from releases

  • Or from npm:
npm install -g css-checker-kit

Start Checking

  • cd to your Project Path. Then just run:
css-checker -styled
  • If only need to check styled-components:
css-checker -css=false -styled

For other usages, please refer to github: CSS-Checker

Demo

Image description


Original Link: https://dev.to/zhcalvin/reduce-duplicated-styled-components-check-here-240p

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To