Skip to content

Commit 7abe277

Browse files
committed
Merge pull request leafo#352 from designerno1/needsCompile-registeredVars
crc32 needsCompile check for serialized registeredVars; refs leafo#333
2 parents f30b722 + e5c40d0 commit 7abe277

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/Compiler.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2701,6 +2701,18 @@ public function unsetVariable($name)
27012701
unset($this->registeredVars[$name]);
27022702
}
27032703

2704+
/**
2705+
* Returns list of variables
2706+
*
2707+
* @api
2708+
*
2709+
* @return array
2710+
*/
2711+
public function getVariables()
2712+
{
2713+
return $this->registeredVars;
2714+
}
2715+
27042716
/**
27052717
* Adds to list of parsed files
27062718
*

src/Server.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ protected function needsCompile($in, $out, &$etag)
143143
return true;
144144
}
145145
}
146+
147+
$metaVars = crc32(serialize($this->scss->getVariables()));
148+
if ($metaVars!=$metadata['vars']) {
149+
return true;
150+
}
146151

147152
$etag = $metadata['etag'];
148153

@@ -213,6 +218,7 @@ protected function compile($in, $out)
213218
serialize(array(
214219
'etag' => $etag,
215220
'imports' => $this->scss->getParsedFiles(),
221+
'vars' => crc32(serialize($this->scss->getVariables())),
216222
))
217223
);
218224

0 commit comments

Comments
 (0)