iznogoudatall / phamlp

Automatically exported from code.google.com/p/phamlp
0 stars 0 forks source link

Sass: Unitless function throws an error #47

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.

create a style.scss file using a variable named $px e.g.
/*** begin of style.scss file ****/
$px: 12;

th {
    font-size: $px;
}
/*** end of file ***/

2.
create a index.php file which parses the scss file with the following php 
instructions
<?php
  include_once('sass/SassParser.php');
  $sass = new SassParser();
  $css = $sass->toCss("style.scss");
  echo $css;
?>

3.
call the 'index.php' page

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by Iki.Holy...@gmail.com on 28 Sep 2010 at 2:04

GoogleCodeExporter commented 8 years ago
Well that posted before it was finished...

Test steps are wrong, if you use the unitless() sass function it will throw an 
error:

    @if unitless($px) {
        // Error is thrown
    }

Line 679 SassScriptFunctions.php:
public static function unitless() {
Should have $number as a parameter, although I then get Call to undefined 
method SassNumber::hasUnits() as an error

Original comment by Iki.Holy...@gmail.com on 28 Sep 2010 at 2:10

GoogleCodeExporter commented 8 years ago
It appears the SassNumber::hasUnits() function does not exist, but a 
SassNumber::isUnitless() function does.

Changing Line 679 SassScriptFunctions.php:
    public static function unitless() {
        SassLiteral::assertType($number, 'SassNumber');
        return new SassBoolean($number->hasUnit());
    }

To:
    public static function unitless($number) {
        SassLiteral::assertType($number, 'SassNumber');
        return new SassBoolean($number->isUnitless());
    }

Fixes the issue.

Original comment by Iki.Holy...@gmail.com on 28 Sep 2010 at 2:16

GoogleCodeExporter commented 8 years ago
This is fixed in https://github.com/MarcWeber/phamlp with the suggested patch
https://github.com/MarcWeber/phamlp/commit/aaeed17368f2fbc5b40716415e0a38f88c6b6
61a

Original comment by gabriel%...@gtempaccount.com on 6 Mar 2011 at 5:37