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

Optional vendor support with global $variables #1

Open
barraponto opened this Issue Aug 9, 2012 · 8 comments

Comments

Projects
None yet
2 participants
@barraponto

That's how Compass does it, and it's pretty useful when you're dealing with mobile apps (webkit-only) or FirefoxOS apps (moz-only). See http://compass-style.org/reference/compass/support/

@danillonunes

This comment has been minimized.

Show comment
Hide comment
@danillonunes

danillonunes Aug 9, 2012

Owner

This looks like a must-have in future, but for now there's no reason at all to use Property without vendor support.

Owner

danillonunes commented Aug 9, 2012

This looks like a must-have in future, but for now there's no reason at all to use Property without vendor support.

@danillonunes

This comment has been minimized.

Show comment
Hide comment
@danillonunes

danillonunes Aug 9, 2012

Owner

Oh, now I see, you want to disable vendor support for one engine but no all at once. This seems pretty cool, actually. I still don't know how it can be done - less is... less powerful than sass :( - but I'll think of it. Anyway, samples are welcome.

Owner

danillonunes commented Aug 9, 2012

Oh, now I see, you want to disable vendor support for one engine but no all at once. This seems pretty cool, actually. I still don't know how it can be done - less is... less powerful than sass :( - but I'll think of it. Anyway, samples are welcome.

@barraponto

This comment has been minimized.

Show comment
Hide comment
@barraponto

barraponto Aug 9, 2012

Did you see how Compass implements it? Doesn't Less support global variables?

Did you see how Compass implements it? Doesn't Less support global variables?

@danillonunes

This comment has been minimized.

Show comment
Hide comment
@danillonunes

danillonunes Aug 22, 2012

Owner

The first problem is that "variable" in Less isn't really a variable, is a constant, it can be defined only once.

So I can't do something like set @awesome-support: true by default and ask the users to set it to false if they wants to disable it. Also I can't ask them to set all the variables they want to true because it's a pita.

So all that can be done is expect a variable like @disable-awesome-support: true to be set only when the user wants to disable the feature.

The second problem is that, afaik, variables defined in a parent file aren't accessible inside the children files. So I can't do something like

in my-custom-css.css.less

@disable-awesome-support: true;
@import 'property/property.css.less
selector {
  .awesomeness();
}

in property/property.css.less

.awesomeness () {
  some-property: awesome;
}
.awesomeness () when (@disable-awesomeness-support) {
  some-property: sans-awesome;
}

The result will always be awesome (which is awesome, but the user is expecting a lack of awesomeness in this case).

Owner

danillonunes commented Aug 22, 2012

The first problem is that "variable" in Less isn't really a variable, is a constant, it can be defined only once.

So I can't do something like set @awesome-support: true by default and ask the users to set it to false if they wants to disable it. Also I can't ask them to set all the variables they want to true because it's a pita.

So all that can be done is expect a variable like @disable-awesome-support: true to be set only when the user wants to disable the feature.

The second problem is that, afaik, variables defined in a parent file aren't accessible inside the children files. So I can't do something like

in my-custom-css.css.less

@disable-awesome-support: true;
@import 'property/property.css.less
selector {
  .awesomeness();
}

in property/property.css.less

.awesomeness () {
  some-property: awesome;
}
.awesomeness () when (@disable-awesomeness-support) {
  some-property: sans-awesome;
}

The result will always be awesome (which is awesome, but the user is expecting a lack of awesomeness in this case).

@barraponto

This comment has been minimized.

Show comment
Hide comment
@barraponto

barraponto Aug 24, 2012

So I guess you won't be able to port bourbon to LESS. https://github.com/thoughtbot/bourbon
:|

So I guess you won't be able to port bourbon to LESS. https://github.com/thoughtbot/bourbon
:|

@danillonunes

This comment has been minimized.

Show comment
Hide comment
@danillonunes

danillonunes Aug 24, 2012

Owner

So I figure out I can use variables from a parent file, but I'm still a bit stuck on how I can use different mixins according to a variable existence.

This gist is where I'm doing my tests: https://gist.github.com/3442700

lessc custom.css.less is outputting:

selector {
  some-property: awesome;
  some-property: sans-awesome;
}

the expected result is

selector {
  some-property: sans-awesome;
}
Owner

danillonunes commented Aug 24, 2012

So I figure out I can use variables from a parent file, but I'm still a bit stuck on how I can use different mixins according to a variable existence.

This gist is where I'm doing my tests: https://gist.github.com/3442700

lessc custom.css.less is outputting:

selector {
  some-property: awesome;
  some-property: sans-awesome;
}

the expected result is

selector {
  some-property: sans-awesome;
}

@ghost ghost assigned danillonunes Aug 24, 2012

@danillonunes

This comment has been minimized.

Show comment
Hide comment
@danillonunes

danillonunes Aug 24, 2012

Owner

Oh, and thanks for the Bourbon link, it looks like exactly what I aim with Property.

Owner

danillonunes commented Aug 24, 2012

Oh, and thanks for the Bourbon link, it looks like exactly what I aim with Property.

@barraponto

This comment has been minimized.

Show comment
Hide comment
@barraponto

barraponto Aug 26, 2012

Yeah, Bourbon is an almost ruby-less library for SASS. I thought it aimed to be absolutely independent of Ruby, so it would fulfill a demand that Compass can't. But it started to use SASS functions defined in Ruby so... go figure.

Yeah, Bourbon is an almost ruby-less library for SASS. I thought it aimed to be absolutely independent of Ruby, so it would fulfill a demand that Compass can't. But it started to use SASS functions defined in Ruby so... go figure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment