less / old-lesscss.org

The OLD lesscss.org. For the new one see less-docs.
http://lesscss.org
90 stars 48 forks source link

info about extends #73

Closed lukeapage closed 11 years ago

lukeapage commented 11 years ago

can use http://www.scottlogic.co.uk/2013/03/extends-in-less/ as a base

jonschlinkert commented 11 years ago

@lukeapage unless someone else beats me to it, I will be sure to use that blog post as a base for the extend documentation. good write up

extemporalgenome commented 11 years ago

It'd be useful to have concrete information on the mechanism. For example, it's clear to me why (from the blog post) the .button-red example works, but not why the .add_ie_support use of .first:extend(:nth-child(1)) produces tr.first rather than just .first. With my rather limited understanding of this feature, I'd think it'd usually be more useful to produce exactly what is specified, rather than having the result prefixed with the dynamically discovered selector. In other words, if I wanted tr.first in the output, I would have specified tr.first:extend(:nth-child(1) all) -- what then is the benefit of this implicit prefixing?

maranomynet commented 11 years ago

+1 what @extemporalgenome said.

And why/how does :extend(:nth-child(1)) match the selector tr:first-child(1) at all?

And what if I have multiple .menu { ... } declarations - what happens when I do .menu2:extend(.menu') ?

And what if when I extend a selector inside one @media block, and that same selector also exists inside another @media block. What then?

What happens if I extend a mixin? i.e. .clearfix() { ... } .foo:extend(.clearfix) {}

maranomynet commented 11 years ago

Hmmm... I found the test files and am now reading through those.

SomMeri commented 11 years ago

I started to write about extend on less4j wiki. I will be happy to add the same or similar to less.js documentation too once it is finished.

I just do not want to do it while less.js documentation refactoring is in progress.

lukeapage commented 11 years ago

I was going to write some more info for the website, starting with porting the blog article I wrote.. If you write some more for the java version I will consider putting that on the site. I'm not 100% sure on what the current state of the documentation refactor is so I've been planning for some time to make updates to the website. Plan is to release 1.5 then do that.. then more bugfixes and 1.5.1.

SomMeri commented 11 years ago

@lukepage Whichever you prefer. I will write some more for java in any case, I always document what I ported. It helps me to remember what I intended to implement later on (if that makes sense).

On documentation: Altrough I would like to help with less.js, but I do not have enough time to learn it right now. Starting with new codebase requires bigger time chunks that I have available. I also wanted to catch up with less4j first, it should have at least those features that bootstrap uses.

However, I could be able to process at least simple pull requests for documentation in the meantime. Some of them seem to be simple typo fixes and do not require that much learning as codebase. People are more likely to contribute if they do not see huge backlog of unanswered pull requests.

What do you think?

lukeapage commented 11 years ago

@SomMeri sorted it out now..

sytelus commented 11 years ago

@SomMeri - thanks for excellent write up and especially making clear the syntax and example for multiple extends.

@lukeapage - looking forward to see your page merged with @SomMeri.

sytelus commented 11 years ago

@SomMeri - thanks again for good writeup. I'd put question for how to use multiple inheritance on StackOverflow and your article was the only thing I found after hours of search that gave an answer. Here's my solution: http://stackoverflow.com/a/20158738/207661

lukeapage commented 11 years ago

you can see the current final write up here https://github.com/less/less-docs/blob/master/content/features/extend.md

I would really really like to get our new docs as good as the current ones and replacing the website ASAP. :S