-
Notifications
You must be signed in to change notification settings - Fork 473
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
add scss support via leafo/scssphp #549
Conversation
the functionality we are using is present
this is needed for @import to be able to resolve included files
tested cache dependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would like some answers and some explanation on the visibility logic, along with cleaner test & composer version.
Nothing broken though, so not exactly blocking merge.
* | ||
* @link https://github.com/leafo/scssphp/ | ||
*/ | ||
class Minify_ScssCssSource extends Minify_Source { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be Minify_ScssCssSource or Minify_ScssSource? If Minify_ScssCssSource, shouldn't it extend Minify_CssSource?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think they both should rather depend on new Base Source class or the support that these classes have added to Source class. i.e some kind of cleanup/refactoring (in separate PR)
* | ||
* @var array | ||
*/ | ||
private $parsed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the class isn't final
, Why have private properties in favor of protected ones?
} | ||
|
||
/** | ||
* Make a unique cache id for for this source. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"unique" amounts to common string + md5 hash these days?
Either provide some actual uniqueness (via UUID or similar) or drop the word unique
} | ||
} | ||
|
||
$input = $cache ? $cache : $this->filepath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 90 - 96 look like something that belongs inside a cache adapter
} | ||
} | ||
|
||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from the implementation of this method, if $cache
is an array with at least one value OR an instance of ArrayAccess , it isn't considered "stale", regardless of contents (as long as there's no 'files' index).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code assumes the cache is not corrupted. so there is always 'files' key present with at least one entry.
* | ||
* @return boolean True if compile required. | ||
*/ | ||
public function cacheIsStale($cache) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the public visibility all of a sudden, if most of the rest of this class seems to be private?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noticed this myself too. will fix.
$scss->setImportPaths(dirname($filename)); | ||
|
||
$css = $scss->compile(file_get_contents($filename), $filename); | ||
$elapsed = round((microtime(true) - $start), 4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
STYLE: seems that half of this method is shifted by one space, here's where the shift starts
$mtime1 = filemtime($mainLess); | ||
var_dump($mtime1); | ||
$mtime2 = filemtime($includedLess); | ||
var_dump($mtime2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does test include var_dumps ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will remove from here and other tests after PR being merged.
@@ -34,6 +34,7 @@ | |||
}, | |||
"require-dev": { | |||
"leafo/lessphp": "~0.4.0", | |||
"leafo/scssphp": "^0.3.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find "~0.3" a bit more expressive than this.
This gives off the notion of a very specific version, but actually, it's ">= 0.3.0 <1.0.0" (at least since composer 1.0.0 ) https://getcomposer.org/doc/articles/versions.md#caret
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the library is semver compliant and pick 0.3 for php 5.3 and 0.6 for php 5.4+
@mrclay i would like to get this merged. the PR is ready for merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides style issues seems OK.
Implemented by same design as lib/Minify/LessCssSource.php