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

Error when :extend's selector can't be found #2459

Closed
tomek-he-him opened this issue Feb 19, 2015 · 3 comments
Closed

Error when :extend's selector can't be found #2459

tomek-he-him opened this issue Feb 19, 2015 · 3 comments

Comments

@tomek-he-him
Copy link

this fails silently:

.foo {
  &:extend(.bar-baz);
}

.bar {
  &-baz {
    some: stuff;
  }
}
$ lessc this
.bar-baz {
  some: stuff;
}

– from #2453

Putting aside if it should work or not – that's being discussed in #2200.

In my view it should throw some kind of error when selector is undefined in the scope of :extend(selector). Like undefined mixins throw a SyntaxError.

Otherwise there's no way to spot the failure other than manually scanning through the output.

@seven-phases-max
Copy link
Member

Non-matched extends produce warnings now (the only problem you won't see a warning when compiling with anything other then lessc in.less out.css but that's the warning implementation itself to be polished further).

As for error or warning thing itself it might be questionable (rationale behind warnings is that you may have some generic code that intentionally uses not always matching extends), but this actually to be solved if we'll go a canonical compiler route and have multiple warning levels controlled by cli-options including one for warning -> error (i.e. "warning implementation polishing" again).

@tomek-he-him
Copy link
Author

rationale behind warnings is that you may have some generic code that intentionally uses not always matching extends

Reasonable :)

Non-matched extends produce warnings now (the only problem you won't see a warning when compiling with anything other then lessc in.less out.css but that's the warning implementation itself to be polished further).

Cool :) I can close this issue then. I do have some more thoughts, but I guess it'd be better if I write them in an issue dedicated to the implementation of warnings. Is there such, @seven-phases-max?

@seven-phases-max
Copy link
Member

Is there such?

No (I was actually thinking of creating one myself, but I just do not want to spam issues unless I'm about to put at least part on myself and for the moment I'm a bit limited in coding).

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

2 participants