-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
First cut of selector optimization (issue #100) #114
Conversation
Wow this is great stuff! I'll review more tomorrow, but it looks awesome! Thanks :D |
Holy underwear! That's a lot of changes. Good work, sir. I'll dig in and give this bad boy a go. |
Wow, great stuff. This is how you do a pull request! |
Sweet baby jeebus. We're working on merging a lot of this by hand right now—most was able to get most of the files merged without a problem, but the patterns gave us shit after I refactored the dropdowns. More to come on this! |
No rush! I'm glad you're incorporating it. Let me know if you find any issues that I need to fix. |
Closing this—we merged karthikv's pull in awhile back and have made many updates since then for the upcoming release. More to come when that drops. |
Documentation: how to use Bootstrap mixins with multiple values
As per my description on issue #100, selectors like these:
should be replaced by more efficient and simplified counterparts that don't have prodigal descendants:
The commits associated with this pull request achieve many optimizations similar to the ones above in all LESS files that need them. In addition to the aforementioned examples, selectors with non-generic class names as descendants, like so:
have also been optimized by simply removing the parent selector:
This has only been done where class names are unique and quite unlikely to be re-used elsewhere.
In terms of statistics, five of the eight LESS files benefited from these optimizations, many in a significant manner. More than just greater efficiency, this also cut down about 700 bytes (~2%) from the minified stylesheet. Considering that the only change was to selectors, I would say this is a nice bonus.
Even though this takes care of many optimizations, there are still various methods to accomplish even more. For example, because a decent number of class names are generic, the selectors including them require more context and therefore more complexity. Changing the markup to supplant optimization and circumvent these cases is a frontier not explored in these commits. Re-thinking the CSS structure as a whole can also result in insights of what can be consolidated. For these reasons, I ask that you continue to keep issue #100 open so that further optimization—and discussion regarding it—is continually strived for.