painty / CSS-Used-ChromeExt

Get all css rules used by the selected DOM and its children.

Home Page:https://chrome.google.com/webstore/detail/css-used/cdopjfddjlonogibjahpnmjpoangjfff

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm module

emmastone9 opened this issue · comments

Hi,
Suggestion: Is it possible to build NPM module or an API wrapper that can query a given node for a URL and output the local preview to HTML file?

I am happy to contribute back as a PR, will need some hand holding though..

I can't think of such a usage scenario. Could you explain why you need it to work in a NPM way?

I am trying to get the extension working in chrome headless mode and thereby an API will be useful.

So let me guess. You want to " tree-shaking" CSS ?

It's not safe to use this extension to do such thing currently. Because the result is generated based on the CURRENT HTML DOM.

If a div doesn't exist in the document unless a specific user interaction, the result may miss out the style rules for the newly born div.

In another words, the result is only responsible for the moment you inspect the target element.

Maybe there can be a "start monitor" and "stop monitor" , and the result can reflect the period but not the snapshot.

@painty you are correct, the above will only get a snapshot at time t.
95% of the pages that we are using the extension are static and thereby need the result based off current html dom.

Is it possible to get current HTML DOM / CSS Used via an API call or something that can be done via CLI?