-
Notifications
You must be signed in to change notification settings - Fork 60
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
Interpolation Problem (LibSass related?) - Found Fix #23
Comments
Thanks @Isaaki for the kind words. This smells like a LibSass problem that might warrant an isolated case filed with them as well (I could be wrong of course, but just my gut reaction). To start I need to know the following…
|
Same issue here, using:
Thanks, @Isaaki, for the workaround. Just to say, I love Typeplate. It has become the only css framework I ever start a project with - it doesn't dictate design patterns, yet brings the subliminal magic needed for harmony. p.s - will it help if I add a comment on that issue you opened on the libsass git? |
@rhumbus Thanks! That's so awesome to hear. I use it all the time myself ;) If you feel like adding to the issue thread on libsass because you have something meaningful to add by all means, but I wouldn't clog it up just because. |
Hi, I'm still getting the error with the extra space before the unit with libSass. But this is the fix I'm using in @function typl8-context-calc($scale, $base, $value) {
@return #{$scale/$base}#{$value}; // chaining two interpolations
} And: @function typl8-measure-margin($scale, $measure, $value) {
$pixelValue: $measure/$scale;
$remValue: $pixelValue * $typl8-font-base;
@if $value == rem {
@return #{$pixelValue}#{$value};
} @else if $value == em {
@return #{$remValue/$scale}#{$value};
} @else {
@return #{$remValue}#{$value};
}
} And I love Typeplate too! Thanks, Fred |
@blustemy +1 - this fixed worked for me. |
Here's the fix I plan to implement in Sassmeister until I can merge the code into the project http://sassmeister.com/gist/f8197ffbac32689e84a8 |
Just to clarify what is going on: there is indeed an issue on LibSass end with string interpolation. Actually, it is not the first one, and will probably not be the last. That being said, the issue should not be a problem for Typeplate whatsoever when doing things slightly more elegantly. Basically the problem here is that we deal with units as if they were random strings living on the right of some numbers. This is not how it works. We gotta see units as if they were completely indivisible from numbers. Units cannot live on their own. My point is, rather than appending the unit as a string at the end of a number, we better multiply that number by 1 of this unit (or add 0 of this unit, it works as well). So instead of: @function typl8-measure-margin($scale, $measure, $value) {
$pixelValue: $measure/$scale;
$remValue: $pixelValue * $typl8-font-base;
@if $value == rem {
@return $pixelValue#{$value};
} @else if $value == em {
@return ($remValue/$scale)#{$value};
} @else {
@return $remValue#{$value};
}
} We could have: @function typl8-measure-margin($scale, $measure, $value) {
$pixel-value: ($measure / $scale);
$rem-value: ($pixelValue * $typl8-font-base);
@if unit($value) == 'rem' {
@return $pixel-value * $value;
} @else if unit($value) == 'em' {
@return ($rem-value / $scale) * $value;
} @else {
@return $rem-value * $value;
}
} Or a bit more elegant (at least to me): @function typl8-measure-margin($scale, $measure, $value) {
$pixel-value: ($measure / $scale);
$rem-value: ($pixelValue * $typl8-font-base);
@if unit($value) == 'rem' {
$v: $pixel-value;
} @else if unit($value) == 'em' {
$v: ($rem-value / $scale);
} @else {
$v: $rem-value;
}
@return $v * $value;
} So at the end of the day, all we need is to make |
@hugogiraudel You the man! Thanks again! |
That's an excellent piece of advice @hugogiraudel, I'll also use it on my projects! Thanks a lot. |
Greetings,
First off, love the project. Many thanks for your work.
Now, I'm using LibSass (via GulpSass) to compile. In general, LibSass is always a bit slow to implement new Sass features (though it's incredibly fast, which is why I use it). Anyways, I found that some of the typeplate functions were being returned with spaces between measurements and their values (like
font-size: 32 rem
instead of `font:size: 32rem'), so naturally this was read by the browser and the User Agent Stylesheet defaults were being used.Took me a while to realize what was going on, but here's the fix that worked for me:
Around line
200
of _typeplate.scssAnd in the line
225
block:Not sure if this should be integrated into a pull request or if you'd rather leave things as they were before for some reason. Not sure if this will cause issues for other Sass compiling methods, but it's working for me.
The text was updated successfully, but these errors were encountered: