-
Notifications
You must be signed in to change notification settings - Fork 19
Conversation
|
Can you clarify what you mean by "lite option"? Could organizing the returned object's properties alphabetically be the simplest convention anyone reading through it? Besides those questions, this looks like a rad update. I love the use case examples and performance optimizations overall. I've rarely seen a better looking PR. ❤️ |
|
lib/selectors.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😻
|
👏 This is beautiful! I was thinking of improving the return object while working on a project that relies on Just one thing though, what if properties like |
|
This is amazing! Loving how this approach is cleaning up the code so drastically while removing a lot of duplicated return content. tl;dr
Definitely.
I've been pondering this one a bit, and I think that the presentation layer is likely the best location for this. It feels kinda hacky to add a So, it's likely best to expose a function that is contextually aware of something like
I think it may be useful to expose some stats on the CSS contained within each media query, as this could help illustrate CSS with architectural problems. However, this could be handled in the usage section similar to the other examples you've outlined. Also, this new approach will take care of /pull/12! 👯
IMO, the libs should receive the option and handle it accordingly. I think we could also take further steps to modularize this project by breaking a lot of the lib stuff into standalone modules. We should also break the cli into
I agree with @rafaelrinaldi here, that would be great! Usage examplesThe usage example section is wonderful, too. I like the idea of not bloating the returned object with data that is less likely to be used. Though, I think we should probably either expose these as options, i.e. A pluggable API?I think it might be worthwhile considering some type of pluggable API. That way users could incorporate their own functions and require more esoteric stats examples if they'd like: var cssstats = require('cssstats')
cssstats(myCss).use(require('cssstats-display-none'), require('cssstats-specificity-sort'), function(stats) {
// ... Do some crazy stuff with the stats object
})Not exactly sure how this would work, but somehow each of these "plugins" of additional statistical information could somehow add to the returned stats object. Thoughts? |
|
This is super helpful. Thanks! @rafaelrinaldi @johnotander as far as the My thinking with the shorthand properties and other example is that they might make sense as methods, such as I'm down to add more information to the media query object – any ideas on how to parse the contents of a media query block and what to show? Passing The idea of a pluggable API is interesting. We could probably rely on the postcss plugin architecture for that – there's probably a sane way to tack on any postcss plugin to cssstats. |
I'd say the property and value. As it'd really shed some light on any duplicated declarations with the
👍
Off the top of my head, I believe all the contained styling is available as
I think this might be the best approach. Though, we will then have to consider how we convert the returned object to JSON. Perhaps exposing a
Yeah, I'm not quite sure if this is something that would be worthwhile/useful to end users. Especially if it's not easy to somehow lean on PostCSS to solve this (I will have to do some digging). Ultimately, the main problem I'm seeing here is that we have different levels/scopes of information that we want to expose in terms of data/stats: Lite, Default, All The Things, Custom Things. It might just be as simple as making options: |
|
On a side note, I would love to rename this repo |
|
Just published a beta if anyone ones to test it out: |
|
Just did some hand testing with the beta, comparing it to the output with cssstats.com and it looks accurate. Not to mention, the returned object is much more human readable. Awesome work!
|
|
I've added and updated tests and have been trying this out in the new app. Everything feels good to me, and if there's no objections, I'd like to publish an official release today. |
README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default
👯 👯 👯 |
v2
This is presented as a prototype for discussion. This doesn't have to be the actual v2, but I do like a lot of the things happening here. Would love some feedback and questions.
What
New returned object
To do
Questions
optsbe passed to each module inlib? Or should the modules be split up further?Usage examples
UPDATE
I've added some helper methods that make the examples below redundant.
Get total number of unique colors
display: nonecountFind the selector with the highest specificity
Sort selectors by highest specificity
Specificity graph
Rule size graph