Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

scssphp: get children #504

Closed
wants to merge 6 commits into
from

Conversation

Projects
None yet
9 participants
Contributor

lalop commented Sep 29, 2013

No description provided.

@staabm staabm commented on an outdated diff Sep 29, 2013

src/Assetic/Filter/ScssphpFilter.php
+ $children = array();
+ foreach($this->scss_compiler->getParsedFiles() as $file){
+ $asset = new FileAsset($file);
+ $asset->ensureFilter($this);
+ $children[] = $asset;
+ }
+ return $children;
+ }
+
+ private function compile( $content )
+ {
+ if ($this->compass) {
+ new \scss_compass($this->scss_compiler);
+ }
+ foreach ($this->importPaths as $path) {
+ $this->scss_compiler->addImportPath($path);
@staabm

staabm Sep 29, 2013

Wont this add the path everytime you use one of the public methods?

@staabm staabm commented on an outdated diff Sep 29, 2013

src/Assetic/Filter/ScssphpFilter.php
+ $children[] = $asset;
+ }
+ return $children;
+ }
+
+ private function compile( $content )
+ {
+ if ($this->compass) {
+ new \scss_compass($this->scss_compiler);
+ }
+ foreach ($this->importPaths as $path) {
+ $this->scss_compiler->addImportPath($path);
+ }
+
+ foreach($this->customFunctions as $name=>$callable){
+ $this->scss_compiler->registerFunction($name,$callable);
Contributor

lalop commented Sep 29, 2013

Yes you are right, and the same for the compass initialization.
That's fixed

@stof stof commented on an outdated diff Sep 30, 2013

src/Assetic/Filter/ScssphpFilter.php
@@ -30,6 +31,12 @@ class ScssphpFilter implements DependencyExtractorInterface
private $importPaths = array();
private $customFunctions = array();
+
+ /**
+ * @var \scssc
+ */
+ private $scss_compiler;
@stof

stof Sep 30, 2013

Collaborator

Please use camelCased names

swis commented Oct 10, 2013

👍

Contributor

lalop commented Oct 17, 2013

auto 👍 :)

@kriswallsmith kriswallsmith and 1 other commented on an outdated diff Oct 25, 2013

src/Assetic/Filter/ScssphpFilter.php
@@ -82,7 +78,34 @@ public function filterDump(AssetInterface $asset)
public function getChildren(AssetFactory $factory, $content, $loadPath = null)
{
- // todo
- return array();
+ $this->resetScssCompiler();
+ $this->compile( $content );
+ $children = array();
+ foreach($this->scssCompiler->getParsedFiles() as $file){
+ $asset = new FileAsset($file);
@kriswallsmith

kriswallsmith Oct 25, 2013

Owner

Please use the factory to create new assets.

@lalop

lalop Oct 26, 2013

Contributor

done

Contributor

lalop commented Nov 7, 2013

What about this request ?

@lalop Thanks for your work. I had some kind of infinite recursions issues with your fork, so I fixed them (also removed compass because it seemed to slow down things).

adrienbrault/assetic@kriswallsmith:master...adrienbrault:scss-children

nervo commented Dec 18, 2013

👍

fmosca commented Jan 14, 2014

+1

mfdj commented May 15, 2014

👍 this would be very helpful

Contributor

lalop commented May 16, 2014

this issue is solved here #468

@lalop lalop closed this May 16, 2014

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