Code Monkey home page Code Monkey logo

phpsass's Introduction

#PHPSass build status

#IMPORTANT NOTICE I'm not involved with PHP development anymore, and just don't have the time to do much more than approve pull requests for this project. I'm happy to stick around as a hands-off dictator, but if there are others who wish to take over maintainership then please get in touch ([my username]@gmail.com).

About

This is fork of PHamlP primarily for inclusiong as a Drupal pre-processor. However, there is no Drupal-specific code and it will work for any PHP system.

This version of the compiler is NOT compatible with other forks of PHamlP, and the name has been changed to reflect this.

Other info

Origin: http://code.google.com/p/phamlp/

License: http://www.opensource.org/licenses/bsd-license.php

phpsass's People

Contributors

arkonan avatar blakehancock avatar campbellwmorgan avatar chalker avatar chrisinajar avatar darthsteven avatar decipher avatar fraxachun avatar frederikbosch avatar gabrielfin avatar goncaloe avatar infostreams avatar kaufmo avatar lochmueller avatar marcweber avatar michalkleiner avatar mxmilkiib avatar niaccurshi avatar nsams avatar nyholm avatar richthegeek avatar robloach avatar robocoder avatar scrothers avatar tylermenezes avatar vendethiel avatar xdissent avatar yukulele avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phpsass's Issues

Cut a release

Hello !
First, I'd like to thank you for the work you've done here :). I'm loving Sass, but PHamlP is really dead and finding that here was great help.
There's a little think I'd like to ask tho, I'm trying to avoid using submodules with packagist but as long as you're using "dev-master" (git repo), it's using git submodules. If you could just git tag, that'd help me a lot :). Thanks !

Nested pseudo selector causes error

The following sass won't compile.

div {
    :first-child,
    h1 + * {

    }
}

Produces:

Fatal error: Uncaught exception 'SassScriptOperationException' with message 'Undefined operation "op_unary_times"

Edit: Further investigation has revealed it's the pseudo selector with nothing infront that is causing the problem.

div {
    :first-child {
        border: 0;
    }
}

The above code does not compile correctly, and no error is thrown.

Variables cannot be changed from within a for loop

If you define a variable in a function, you cannot change it from within a for loop. Example code is below.

@mixin test-mixin(val) {
  left: test-function(val);
}

@function test-function($var) {
  $inner-var: "Wrong!";

  @for $i from 1 through 1 {
    $inner-var: "It worked!";
  }

  @return $inner-var;
}


body {
  @include test-mixin('woot');
}

If i replace the line inside the for loop with a return statement then the correct value appears, so I know the loop is running.

Using ie-hex-str() causes PHP warning.

Need to update the function's definition to be stated as a "public static function".

Error:
Strict warning: call_user_func_array() expects parameter 1 to be a valid callback, non-static method SassScriptFunctions::ie_hex_str() should not be called statically in SassScriptFunction->perform() (line 123 of C:\wamp\www\presence\1530chestnut.com\sites\all\libraries\phpsass\script\SassScriptFunction.php).

/*------------------------------------------------------------------------------------------------
OLD CODE - @file SassScriptFunctions.php
------------------------------------------------------------------------------------------------*/
  /**
   * returns an IE hex string for a color with an alpha channel
   * suitable for passing to IE filters.
   */
  function ie_hex_str($color) {// Line No. 657
    if (!($color instanceof SassColour)) {
      $color = new SassColour($color);
    }
    $alpha = round($color->alpha * 255);
    $alpha_str = str_pad(dechex($alpha), 2, '0', STR_PAD_LEFT);
    $col = $color->asHex(FALSE);
    return new SassString(strtoupper('#' . $alpha_str . $col));
  }

/*------------------------------------------------------------------------------------------------
SUGGESTED CODE - @file SassScriptFunctions.php
------------------------------------------------------------------------------------------------*/
  /**
   * returns an IE hex string for a color with an alpha channel
   * suitable for passing to IE filters.
   */
  public static function ie_hex_str($color) {// Line No. 657
    if (!($color instanceof SassColour)) {
      $color = new SassColour($color);
    }
    $alpha = round($color->alpha * 255);
    $alpha_str = str_pad(dechex($alpha), 2, '0', STR_PAD_LEFT);
    $col = $color->asHex(FALSE);
    return new SassString(strtoupper('#' . $alpha_str . $col));
  }

Many, many thanks for the wonderful work!!!

2 semi-colons at end of rules in compiled CSS

Hi, this is something I noticed yesterday while making a few tests. Are semi-colons not required for sass/scss or is this a minor parser bug?

It doesn't break anything so not urgent but it isn't valid CSS which might bother some people.

Bracketed parameters causes exception

Hi, noticed a bug, that I thought I would report:

This SCSS:

@mixin box-shadow($params) {
    -mox-box-shadow: $params;
    -webkit-box-shadow: $params;
}

.shadow {
    @include box-shadow((1px 1px 2px black inset, -1px -1px 2px white inset));
}

Should output:

.shadow {
  -mox-box-shadow: 1px 1px 2px black inset, -1px -1px 2px white inset;
  -webkit-box-shadow: 1px 1px 2px black inset, -1px -1px 2px white inset; }

But instead I get:

Exception Unmatched parentheses: C:\path\to\file\test.scss::7

Double slashes in filenames are interpreted as comments, leading to infinite loop

Using the phpsass toCss method on a file that contains double slashes (//) is interpreted as a comment when the file doesn't exists, even if isFile is set to true.

In SassParser.php file, at line 410 if $isFile is set to true but the file doesn't exist, it is then parsed as source code. This is misleading, since $isFile set to true it should certify that we are passing a filename and not source code.

The SassParser.php class tries to interpret the comment (due to the double slashes) and get stuck in an infinite loop at line 641, trying to find the end of the line.

Using Namespaces

I am really liking this library, but perhaps we can embrace namespaces instead or require statements. It will make the code a lot cleaner. We can utilise the PSR-0 standard and bundle an autoloader if required.

BTW, happy to spearhead

Using @media in a @mixin causes SassContext to Wrap itself

This basic sample will cause some crazy recursion with the getMixin function. Ends up causing timeouts trying to compile. And the longer it goes the deeper it is nested (The more parents $this will have, the eldest of which actually has the mixin).

@mixin small-window {
  @media (max-width : 100px) {
    @content;
  }
}

.awesome {
  width: 50%;

  @include small-window {
    width: 100px;
  }
}

Is phpsass what i need for workflow nirvana?

I'm a front-end developer. My current scenario:

  1. I write scss files
  2. On change, compass 'watch' compiles the scss to css.
  3. I manually FTP the outputted CSS file to the site in question.

What I'd like to do is:

  1. Write scss file.
  2. On change the .scss file is auto-uploaded to the server (I have tools that can auto-update the file when changed by the program).
  3. A tool on the server [phpsass] compiles the scss into css and puts the new .css in the right folder (overwriting the old version).

Does phpsass do the compiling in that way? If so, can someone give me a quick overview of what files I place where and what config settings I need to change?

I'm happy to write up some documentation for the project on how to do this afterwards if that would help to.

Using image data URLs emits notices

This is not related to SASS-specific syntax, as it is standard CSS functionality.

The following, simple CSS code to produce a speckled background on the body:

body {
    background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAAH5FsI7AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3AsYEAgl1K7FqgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAABZQSURBVHjafZzZduS2DkUhanb+/0OdjqsklYb7UN70FuLcXiurO3aVRIIYDg4ANl9fX9dxHMGfpmniuq5omqb+rO/7KMdx1F/yw67rou/7uK4rSinxer2i8MumaWKapoiIaNu2/t22bTRNE2UYhtj3PYZhiPM8Y9u2aJomtm2LruvqU7t936Pruti2Lc7zrL/kw/wpfd/Htm0xjmNERHRdF/u+1800TfN+NWtZ1zU+Pj5iWZboui7O86yb7Ps+utfr9X50KbEsS7RtWz/EZtZ1jXKeZwzDEHyBpVzXVf8upUSzrut1nmddz7qu0fd9ffK+72/xfX5+XhERwzBU0fAlnh4RUfIP+BDLGYbh/cGu6+L1ekXTNDGOY30Sp7OuawzDEN1xHHGeZ/R9X/9+vV717Esp0TRNdOd5xjzPERHxer1i3/fIf9Z1fa8RMfCUpmnqFziZZlmWyxuJiBjHMbZtqxuJiOh4Ghu5riv2fa9PR+BlG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5KkM1+dJjtyDnqGd2GJ/mu2vctuH3c1iUEqjlWOvdwWXFwAejJADoWjv3dVcugLv3j+ZCt7DmoQaXR8FeCAgBu2PKc6nuOrC2udvL1DzBxXNY5gytuc5SXK+h3MrB+R6V3A/j+W1fb9L3/c9AEJoEirdfgh3xyeQbWk045CalfGF3Low7VfMojC/6c1NRvizGt9+Yaf6vSRffd5tvWPI9L3nYyXWSevFbRuF+MaA114VzN4AvIDQrkjk3BxoP6HnCyljS15Z59MKBwQwM7+dv31yWmz5RCt+y58htpGAMbJRxuxnbgyn2VZ51A7DmcR427otJ3R9twhTVtxnmvkObN5txRTDfwIdVELgMtvFfxqxmup12msX2XWMeJcnMULMsy5XpeLfW0jzkbMTFaF9H7N/5+i0PVHPKvo4wQ4ychfhqENrn3MPNs0n78r1hZl/sO3+7QxeMaMbFiMGXBE7T9KOBfNH3iAGO3eTti/V8rYgrbIYavt02N1B6NNq3ZDods6YZl3n0Ktc33LTuSRZPqJqg9Xow3XwXLpHe85C3S8V9427WmN/oKPdSE0zcn2yYwyEQpADlhhoucNuNWFvdmeW7i32FqdkhD5+S0VBtMwOeC/p5Bhml8MVh/PkfV8+wJaYmaTQAAAAASUVORK5CYII=);
}

When parsed using phpsass, it emits the following notices:

Notice: Undefined offset: 2 in script/SassScriptLexer.php on line 73
Notice: Undefined offset: 1 in script/SassScriptLexer.php on line 76

font-size/line-height property doesn't compile right

Note that I've already posted this same response in the following issue but since this is another bug, I think it needs a seperate issue.

p {
  $font-size: 12px;
  $line-height: 30px;
  font: #{$font-size}/#{$line-height};
}

This example is right off of the SASS reference page. Search for:
"If you want to use variables along with a plain CSS /, you can use #{} to insert them."
and you'll find it.

Where it says:
is compiled to:

p {
  font: 12px/30px;
}

Which is obviously not the case, since trying it in the SASS command line and the /try of PHPSASS, I get a positive result in the command line and a negative result online.

What I get when running it in the SASS command line from my PC:

p {
  $font-size: 12px;
  $line-height: 30px;
  font: #{$font-size}/#{$line-height};
}

Is compiled via sass --watch sass:compiled to:

p {
  font: 12px/30px; }

Online the editor itself returns:

p {
  font: 0px;
}

And the ruby console returns nothing.

Clearly a bug?

SassScriptLexer complaining about undefined index...

Hi! I'm not too sure where the problem is coming from but I'm getting a PHP Notice.

I've found a solution, essentially a check is needed to ensure that a usage of preg_match() actually returns matches. The new code simply has a condition that confirms the returned variable is an array and isn't empty.

As I said earlier, I'm really unsure about what might be causing the notice on my end and it's quite possible that it has something to do with the syntax in my SCSS file.

Error:
Notice: Undefined offset: 1 in SassScriptLexer->lex() (line 76 of C:\wamp\www\presence\1530chestnut.com\sites\all\libraries\phpsass\script\SassScriptLexer.php).

// CODE FROM SCSS FILE
@mixin background-gradient($from, $to, $alpha: 1.0) {
  $rgbaTo:      rgba($to, $alpha);
  $rgbaFrom:    rgba($from, $alpha);
  $ieHexTo:     ie-hex-str($rgbaTo);
  $ieHexFrom:   ie-hex-str($rgbaFrom);

/* Old browsers */
  background: $from;
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
  background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzFlNTc5OSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM3ZGI5ZTgiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
/* Chrome10+,Safari5.1+ */
  background: -webkit-linear-gradient(top, $rgbaFrom 0%, $rgbaTo 100%);
/* Chrome,Safari4+ */
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, $rgbaFrom), color-stop(100%, $rgbaTo));
/* FF3.6+ */
  background: -moz-linear-gradient(top, $rgbaFrom 0%, $rgbaTo 100%);
/* IE10+ */
  background: -ms-linear-gradient(top, $rgbaFrom 0%, $rgbaTo 100%);
/* Opera 11.10+ */
  background: -o-linear-gradient(top, $rgbaFrom 0%, $rgbaTo 100%);
/* W3C */
  background: linear-gradient(to bottom, $rgbaFrom 0%, $rgbaTo 100%);
/* IE lte 8 */
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = $ieHexFrom, endColorstr = $ieHexTo);
/* IE8 */
  ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = $ieHexFrom, endColorstr = $ieHexTo);
}
/*----------------------------------------------------------------------------------------
OLD CODE - @file SassScriptLexer.php
----------------------------------------------------------------------------------------*/
if (($match = $this->isWhitespace($string)) !== false) { // Line No. 67
  $tokens[] = null;
}
elseif (($match = SassScriptFunction::isa($string)) !== false) {
  preg_match(SassScriptFunction::MATCH_FUNC, $match, $matches);
  $args = array();
  foreach (SassScriptFunction::extractArgs($matches[SassScriptFunction::ARGS], false, $context) as $key => $expression) {
    $args[$key] = $this->parser->evaluate($expression, $context);
  }
  $tokens[] = new SassScriptFunction($matches[SassScriptFunction::NAME], $args);
}

Hope this helps!

rem units are problematic

When used, they get stripped of "rem", which leaves just a number, which gives em based sizing. This is reproducible with the demo.

undefined method

There seems to be two methods missing SassNumber::length(), and SassNumber::nth().

Syntax Config != File Extension

Is that a bug, when i try to parse my ".sass" file with scss (cause of eclipse syntax hightlighting problems) he use automaticly sass parser.

 $options = array(
    'syntax' => "scss"
  );
  // Execute the compiler.
  $parser = new SassParser($options);
  return $parser->toCss("style.sass"); // Use sass not scss parser

Embedded images

We were seeing a problem with embedded images. What was happening is that at the semicolon in the statement, SassParser was figuring that it was the end of a statement and we would get a statement like this:

background: url(data:image/svg+xml

I added the following exception and it fixes the issue:

         case self::END_STATEMENT:
-          $token = $this->createToken($statement . $c);
-          if (is_null($token)) {
-            $statement = '';
+          if(strpos($statement, 'svg+xml') !== FALSE && strpos($statement, 'base64') === FALSE) {
+            $statement .= $c;
+          } else {
+            $token = $this->createToken($statement . $c);
+            if (is_null($token)) {
+              $statement = '';
+            }
           }

Basically telling the while statement to keep going if it finds a semicolon in this specific context.

Extensions method - add compass

Since #4 was closed -

You mention there the Extensions method from the original Phamlp.

the extensions method has been temporarily removed ... We will be adding them back in once we have fixed on a way to do it properly.

Did you ever got to that ? if not, any hint on what was removed and what should be done ? I'd like to help with that. I'm looking to be able to add compass as it was in the original phamlp, without listing all the functions etc.

Including a mixin in a media query produces a SassContextException.

I get the following SassContextException with the following example code

@mixin mxn() { }
@media only screen and (min-width: 1300px) {
    @include mxn();
}

Fatal error: Uncaught exception 'SassContextException' with message 'Undefined Mixin: mxn' in /home/XXX/public_html/phpsass/tree/SassContext.php:96 Stack trace:
#\0 /home/XXX/public_html/phpsass/tree/SassMixinNode.php(60): SassContext->getMixin('mxn')
#\1 /home/XXX/public_html/phpsass/tree/SassNode.php(332): SassMixinNode->parse(Object(SassContext))
#\2 /home/XXX/public_html/phpsass/tree/SassRootNode.php(71): SassNode->parseChildren(Object(SassContext))
#\3 /home/XXX/public_html/phpsass/tree/SassRootNode.php(80): SassRootNode->parse(Object(SassContext))
#\4 /home/XXX/public_html/phpsass/tree/SassMediaNode.php(80): SassRootNode->render()
#\5 /home/XXX/public_html/phpsass/tree/SassNode.php(332): SassMediaNode->parse(Object(SassContext))
#\6 /home/XXX/public_html/phpsass/tree/SassRootNode.php(71): SassNode->parseChildren(Object(SassContext))
#\7 /home/os in /home/XXX/public_html/phpsass/tree/SassContext.php on line 96

bug with Adjacent-Sibling Selector (+)

the Adjacent-Sibling Selector "+" is buggy with phpsass,
exemple:

dl>dt{
    color:red;
    +dd{
        color:green;
    }
}

don't works

workaround (before fix):

dl>dt{
    color:red;
    &+dd{
        color:green;
    }
}

Use Travis-ci for testing

As we have some functional tests, it would be great if those were available as PHPUnit tests, and then we could easily expose them to Travis-CI for continuous goodness.

bugs on "try" page

Their bugs on the test page : http://www.phpsass.com/try/ :

  • Shift+C shortcut don't works on Firefox (and "C" char can be used in code) use another shortcut (control+enter) or/and button.
  • ruby compilation don't seem to works

Nested rules in media queries don't work

For example, this works:

@media only screen and (max-width: 480px) {
    .excerpt .attachment-thumb {
        display: block;
    }
}

but this doesn't:

@media only screen and (max-width: 480px) {
    .excerpt {
        .attachment-thumb {
            display: block;
        }
    }
}

Using @content re-uses the same content block each time

This is referring to the @content feature.

When a mixin that has a @content block is used more than once, the same content is output for recurring calls.

Here's a quick example that shows the problem (tested on http://www.phpsass.com/try just now). Note that the code is used to output keyframe animation declarations with browser prefixes, but the outputted CSS re-declares "FadeIn" twice, rather than declaring the "GrowWidth" animation as it should:

// Outputs the keyframe declarations with browser prefixes. 
@mixin Keyframes($name) {
    @-webkit-keyframes #{$name} { @content; }
    @-moz-keyframes #{$name} { @content; }
    @keyframes #{$name} { @content; }
}

// Defines a named keyframe sequence, fading an element in.
@include Keyframes(FadeIn) {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

// Defines a named keyframe sequence, growing an element's width.
@include Keyframes(GrowWidth) {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

// creates an animation using defined keyframes.
@mixin Anim($name, $duration, $count) {
    -webkit-animation: $name $duration $count;
    -moz-animation: $name $duration $count;
    animation: $name $duration $count;
}

div#fadeIn {
    @include Anim(FadeIn, 1s, 1);
}

div#growWidth {
    @include Anim(GrowWidth, 1s, 1);
}

This is preprocessed to:

@-webkit-keyframes FadeIn {  from {  opacity: 0;}  to {  opacity: 1;}}
@-moz-keyframes FadeIn {  from {  opacity: 0;}  to {  opacity: 1;}}
@keyframes FadeIn {  from {  opacity: 0;}  to {  opacity: 1;}}

@-webkit-keyframes FadeIn {  from {  opacity: 0;}  to {  opacity: 1;}}
@-moz-keyframes FadeIn {  from {  opacity: 0;}  to {  opacity: 1;}}
@keyframes FadeIn {  from {  opacity: 0;}  to {  opacity: 1;}}

div#fadeIn {
  -webkit-animation: FadeIn 1s 1;
  -moz-animation: FadeIn 1s 1;
  animation: FadeIn 1s 1;
}

div#growWidth {
  -webkit-animation: GrowWidth 1s 1;
  -moz-animation: GrowWidth 1s 1;
  animation: GrowWidth 1s 1;
}

Undefined method SassIfNode::render()

Got this error message:

Call to undefined method SassIfNode::render() in /Users/adrian/treehouse/a_code/a_webdevelopment/mapping.io/app/vendor/PHPSass/tree/SassMediaNode.php on line 82

Here is the code surrounding:

$app->get('/assets/css/style.min.css', function() use ($app){
    $scss = file_get_contents('../precompiles/sass/mapping.io.scss');
    $options = array(
        'style' => 'nested',
        'cache' => FALSE,
        'syntax' => 'scss',
        'debug' => TRUE,
        'callbacks' => array(
            'warn' => 'cb_warn',
            'debug' => 'cb_debug',
        ),
    );

    // Execute the compiler.
    $parser = new \SassParser($options);
    echo $parser->toCss('../precompiles/sass/mapping.io.scss');
});

Can't @extend from included file

I have a _mixins.scss and I include that from my style.scss. In the style.css I want to extend a container class with a clearfix that is declared in the _mixins.scss.
But for some reason the generated CSS doesn't show the container being extended with the clearfix:

'_mixins.scss'

/* Clearfix - h5bp.com/q */
.clearfix {
  *zoom: 1;
  &:before,
  &:after {
    display: table;
    content: "";
  }
  &:after {
    clear: both;
  }
}

'style.scss'

@import "mixins";

#container {
  @extend .clearfix;
  overflow: hidden;

  & > div {
    float: left;
  }
}

which is compiled to:

/*
 * Clearfix - h5bp.com/q
 */
.clearfix {
  *zoom: 1; }
  .clearfix:before,
  .clearfix:after {
    display: table;
    content: ""; }
  .clearfix:after {
    clear: both; }

#container {
  overflow: hidden; }
  #container > div {
    float: left; }

P.S: Thanks so much for maintaining this project, I almost thought I had to put up with PHamlP from 2010, when all I need is a little Sass ...

Compass partials

I don't see any of compass's partials included here, should I take them from somewhere else ? I'm used to other phamlp forks including them under /extensions.
thanks.

PSR

Hi I would like to know if you are planning to implement PSR to your library?

I would like to help that happening.

@mixin and @include order

@include don't works if it's before @mixin

exemple :

.cadre{
    @include myborder;
}

@mixin myborder{
    border:1px dotted  red;
} 

give error :

Undefined Mixin: myborder: styles/test.scss::2 Source: .cadre

Change @import

Currently, @import searches only in the base directories.
I've been able to add relative @imports, based on $parser->token->filename but I'm encountering a problem.

Let's say I have, in my compass.scss file, the following content :

@import "utilities";
@import "typography";
@import "css3";

PhpSass will fail to find it because it can not understand relativity.
With my version, it works, however when utilities is finished resolving, PhpSass tries to resolve typography with token->filename as ... The last parsed file in utilities

Mixin parameters inside @font-face

This mixin returns the same output for every call despite passed arguments are different

@mixin webfont($fontname){
    @font-face{
        font-family: $fontname;
    }
}
@include webfont('first-fontname');
@include webfont('second-fontname');

Renders as:

@font-face {  font-family: 'first-fontname';}
@font-face {  font-family: 'first-fontname';}

@extend not compiling correctly in nested selectors

@extending a class with nested properties like .clearfix below results in the nested properties being applied to the selector itself—for example, .clearfix:after styles are applied to ul li instead of ul li:after.

.clearfix {
    zoom:1;
    &:before, &:after {
        content: "\0020";
        display: block;
        height: 0;
        overflow: hidden;
    }
    &:after {
        clear: both;
    }
}

div { @extend .clearfix; } // works fine

ul li { @extend .clearfix; } // does not

compiles to:

.clearfix,
div,
ul li {
  zoom: 1; }
  .clearfix:before,
  .clearfix:after,
  div:before,
  ul li,
  div:after {
    content: "\0020";
    display: block;
    height: 0;
    overflow: hidden; }
  .clearfix:after,
  div:after,
  ul li {
    clear: both; }

calc() not parsing

Hey hey

Nice work on the Sassy + prepro + this :) Ran into a slight snag while refactoring one of my projects, something (I took a stab and guessed sass hence why this is here and not in the Sassy queue) isn't liking css calc(), it works fine in my straight css doc, in the scss I'm getting the "incompatible units" error. Sass apparently supports it, not sure as of when, guessing recently as I seem to recall you're slightly behind the ruby version.

Is there a way to get them to play nicely or do I just have to wait til it's caught up?

thanks :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.