theKashey / used-styles

📝All the critical styles you've used to render a page.
MIT License
138 stars 10 forks source link

Make CLI #3

Closed vovanezha closed 5 years ago

vovanezha commented 5 years ago

It will be great if you will add CLI for that tool

theKashey commented 5 years ago

Could you explain how it should work for your case?

vovanezha commented 5 years ago

For example, If I want to know which styles are unused I write something like used-styles --path ./dist in the console and get output in a new file or directly in console

theKashey commented 5 years ago

No. You don't get the point of the package - it reports which styles were used right now, when you have rendered exactly this HTML. There is no way it could scan/parse/tokenize source codes and figure out which styles were used, and which were not. The best it could - try to find all the existing styles (as-is) in the sources, but that would not work well.

vovanezha commented 5 years ago

Hmm, okay, I got you. But we already have Coverage tool directly in Chrome DevTools that can show you what JS and CSS are unused at load and run time. Probably, you need to explain users why they should use your tool

theKashey commented 5 years ago

I thought that was clear from the readme and examples provided - to send "used styles" to the browser during SSR. That's more about code splitting and tracking which .css file should be sent to the browser if some class got used.

vovanezha commented 5 years ago

Oh, now I understood. But anyway, it's was unclear from the readme, at least for me

theKashey commented 5 years ago

Nobody perfect 🤷‍♂️