less - lessphp: watch imported files, too -
an annoying problem had lessphp (and less compiling in rails or python/django) is watching file compile not imported files.
for illustration less construction looks this:
// main.less // (compiled styles.css) @import "variables" @import "objects" @import "theme"
.
// theme.less // (actual styles) body { background:#efefef }
so actual compiled file root import styles , files work on. everytime create alter on styles(theme.less) have edit main.less gets recompiled.
is there alternative check files changes on client-side compile(less.js)?
when inspect source of php lessc compiler, can found @ https://raw.githubusercontent.com/oyejorge/less.php/master/bin/lessc, found script evaluate modification time of less file have passed argument.
when less files in /home/project/less
can add together instance next code within while(1) loop in bin/less, around line 125:
while (1) { clearstatcache(); //keep original code here $dir = '/home/project/less'; $dh = opendir($dir); while (false !== ($filename = readdir($dh))) { if(preg_match('/\.less$/',$filename) && filemtime($filename) > $lastaction) { $updated = true; break; } } if($updated) break; }
less lessphp
No comments:
Post a Comment