0

What is the best way to extract only the CSS used including those used by JavaScript.

I tried CSS Usage seems to have stopped working with the current versions of firefox

Dust-Me works but it classifies css used by javascript as unused css.

1
  • Are you trying to scrape the CSS, or access it via JS within a page? It looks like you're looking specifically for a Chrome extension? Commented Jun 30, 2017 at 16:06

1 Answer 1

1

The newest version of Google Chrome now has this feature built-in.

From the developer tools (press F12 to show them), there is now a new "Coverage" menu.

enter image description here

enter image description here

Simply start recording, reload the page, and then stop recording.

It will show JS/CSS coverage:

enter image description here

You can then click on an individual CSS files to see coverage details:

enter image description here

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

2 Comments

Very good, this seems to work correctly. Does it have any way to save only the used code or do I have to manually clean it?
@BrunoAndrade I don't believe there's a way to do that. The browser (Google Chrome) doesn't have write access to the actual source code files, just read access to a copy of it sent over the network.

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.