Skip to content
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

Selector optimization #100

Closed
karthikv opened this issue Aug 26, 2011 · 3 comments
Closed

Selector optimization #100

karthikv opened this issue Aug 26, 2011 · 3 comments

Comments

@karthikv
Copy link
Contributor

Even though nesting properties in LESS feels so natural, it often results in inefficient CSS that overuses the costly descendant selector, as shown below:

.topbar form input
.pagination ul li a
.topbar ul li ul li a
.tabs li a

Removing the superfluous descendants yields much more optimized—and simplified—CSS:

.topbar input
.pagination ul a /* or */ .pagination li a
.topbar ul ul a /* or */ .topbar li li a
.tabs a

Although these changes may make the LESS files a tad less intuitive, they are valuable when it comes to speed and will be of benefit to a large CSS framework such as this.

@mdo
Copy link
Member

mdo commented Aug 28, 2011

For sure. We've made incremental changes to a lot of things to try to optimize selectors. Good feedback here :). We'll try to make this a continual effort, in addition to fixing this issues here.

@karthikv
Copy link
Contributor Author

It's good to hear that you're interested. I just recently created a pull request consisting of multiple optimizations; see #114.

@karthikv karthikv reopened this Aug 28, 2011
@fat
Copy link
Member

fat commented Sep 2, 2011

i believe these were included in 1.2 thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants