File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -331,6 +331,26 @@ your custom feature using the `addFeature` method:
331331
332332* ` addFeature($name) ` registers the ` $name ` .
333333
334+ ### Exception Handling
335+
336+ If your web appilcation compiles SCSS on-the-fly, you need to handle any potential
337+ exceptions thrown by the Compiler. This is especially important in a production
338+ environment where the content may be untrusted (e.g., user uploaded) because
339+ the exception stack trace may contain sensitive data.
340+
341+ {% highlight php startinline=true %}
342+ use Leafo\ScssPhp\Compiler;
343+
344+ try {
345+ $scss = new Compiler();
346+
347+ echo $scss->compile($content);
348+ } catch (\Exception $e) {
349+ echo '';
350+ syslog(LOG_ERR, 'scssphp: Unable to compile content');
351+ }
352+ {% endhighlight %}
353+
334354## SCSS Server
335355
336356The SCSS server is a small class that helps with automatically compiling SCSS.
You can’t perform that action at this time.
0 commit comments