Skip to content
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 support for sassc command (libsass) #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mkuettel
Copy link
Contributor

I installed sassc on my dev env and set the option 'sacy.sass' to /usr/bin/sassc to test this.

I don't know whether it makes sense to switch, I'm still testing performance. But It's quite annoying having to wait ~5s for a simple css change to appear when developing locally. Maybe when this is fast enough we could even use something like livereload, but for that to be useful the compilation time of the css has to improve.

@mkuettel
Copy link
Contributor Author

I tested the performance using this patch

diff --git a/src/sacy/ext-translators.php b/src/sacy/ext-translators.php
index 8cfbf83..c39c89e 100644
--- a/src/sacy/ext-translators.php
+++ b/src/sacy/ext-translators.php
@@ -18,6 +18,7 @@ abstract class ExternalProcessor{
         }
         $cmd_string = implode(' ', $env_vars). ' ' . $cmd;
 
+        $start = microtime(true);
         $p = proc_open($cmd_string, $s, $pipes);
         if (!is_resource($p))
             throw new \Exception("Failed to execute $cmd");
@@ -32,6 +33,14 @@ abstract class ExternalProcessor{
         fclose($pipes[2]);
 
         $r = proc_close($p);
+        $end = microtime(true);
+        $time = $end - $start;
+        file_put_contents("/tmp/sacy_timelog.txt",
+            "Cmd $cmd_string\n" .
+            "Start $start\n" .
+            "End $end\n" .
+            "Time {$time}\n",
+            FILE_APPEND);
 
         if ($r != 0){
             throw new \Exception("Command returned $r: $err");

I then forced the CSS to recompile by changing the version of dental:

Cmd  /usr/local/bin/sass --cache-location='/tmp' -s --scss  -I '/var/webapps/popscan/pcache/asset_compile/fonts/icon/005741d44bfc79a553d45e3a1fdf543a' -I '/var/webapps/popscan/htdocs/themes/dental/css' -I '/var/webapps/popscan/htdocs/themes/dental/css/modules' -I '/var/webapps/popscan/htdocs/styles/cebus/modern/fragments' -I '/var/webapps/popscan/htdocs/styles/cebus/modern/fragments/tabbed' -I '/var/webapps/popscan/htdocs/themes/dental/css/fragments' -I '/var/webapps/popscan/htdocs/themes/dental/css/custom' -I '/var/webapps/popscan/htdocs'
Start 1560347429.7274
End 1560347430.5281
Time 0.80075788497925
Cmd  /usr/bin/sassc -s   -I '/var/webapps/popscan/pcache/asset_compile/fonts/icon/005741d44bfc79a553d45e3a1fdf543a' -I '/var/webapps/popscan/htdocs/themes/dental/css' -I '/var/webapps/popscan/htdocs/themes/dental/css/modules' -I '/var/webapps/popscan/htdocs/styles/cebus/modern/fragments' -I '/var/webapps/popscan/htdocs/styles/cebus/modern/fragments/tabbed' -I '/var/webapps/popscan/htdocs/themes/dental/css/fragments' -I '/var/webapps/popscan/htdocs/themes/dental/css/custom' -I '/var/webapps/popscan/htdocs'
Start 1560347466.4036
End 1560347466.6419
Time 0.23827719688416

So there is indeed a performance improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant