-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shorthand vs longhand stats #10
Comments
I actually think comparing usage of longhand vs shorthand for all shorthands would give us a lot of good insight in terms of what makes a good shorthand. |
Should this be put in relation to the CSS being minified? #25 (I donʼt know whether common minifiers are sophisticated enough to generate shorthands where possible.) |
I highly doubt any minifiers do that, but even if they did, the primary interest of this measurement is not related to minfication. |
Whatever JS we write, we will need some input on what the shorthands are. I wrote this script so we don't need to manually maintain such a list, we can just copy the object generated: https://codepen.io/leaverou/pen/gOPEJxz?editors=0010 |
So, in terms of an analysis algorithm:
It would also be interesting to note when longhands are used in cases a shorthand would have been more appropriate, e.g. due to lack of knowledge about its arguments, and which shorthands are the least utilized. However, since a shorthand resets all of its longhands to |
Just pushed JS for this. It counts:
Sample output for Smashing Magazine's CSS: {
"margin": {
"1": 119,
"2": 147,
"3": 29,
"4": 47
},
"overflow": {
"1": 62
},
"border-bottom": {
"1": 9,
"2": 1,
"3": 24
},
"text-decoration": {
"1": 50,
"2": 1
},
"border-style": {
"1": 5
},
"padding": {
"1": 164,
"2": 213,
"3": 20,
"4": 68
},
"outline": {
"1": 15,
"2": 1,
"3": 9
},
"border": {
"1": 41,
"3": 47
},
"animation": {
"1": 1,
"2": 2,
"3": 17,
"4": 4,
"5": 1
},
"flex": {
"1": 12,
"3": 6
},
"background": {
"1": 132,
"2": 69
},
"border-radius": {
"1": 167,
"4": 26
},
"border-top": {
"3": 5
},
"grid-row": {
"1": 1,
"2": 1
},
"transition": {
"1": 2,
"2": 4,
"3": 165
},
"font-variant": {
"1": 29
},
"background-position": {
"1": 1,
"2": 75,
"3": 39,
"4": 3
},
"background-repeat": {
"1": 91
},
"list-style": {
"1": 28
},
"border-left": {
"1": 4,
"3": 9
},
"grid-column": {
"1": 2,
"2": 4
},
"border-right": {
"1": 1,
"3": 7
},
"border-color": {
"1": 29
},
"border-width": {
"1": 4,
"4": 1
},
"font": {
"4": 2
},
"columns": {
"1": 1
},
"grid-gap": {
"1": 2,
"2": 1
}
} |
Popular shorthands, e.g. transition, background, font, animation. Are the numbers maybe low due to the fact that the order of the values is not that easy to remember without checking the documentation?
(by @catalinred)
The text was updated successfully, but these errors were encountered: