コード例 #1
0
ファイル: php-sass-watcher.php プロジェクト: Rchek/PensDev
        while (1) {
            // get all .scss files from scss folder
            $filelist = glob($scss_folder . "*.scss");
            // step through all .scss files in that folder
            foreach ($filelist as $file_path) {
                // get path elements from that file
                $file_path_elements = pathinfo($file_path);
                // get file's name without extension
                $file_name = $file_path_elements['filename'];
                // get .scss's content, put it into $string_sass
                $string_sass = file_get_contents($scss_folder . $file_name . ".scss");
                // try/catch block to prevent script stopping when scss compiler throws an error
                try {
                    // compile this SASS code to CSS
                    $string_css = $scss_compiler->compile($string_sass);
                    // write CSS into file with the same filename, but .css extension
                    file_put_contents($css_folder . $file_name . ".css", $string_css);
                } catch (Exception $e) {
                    // here we could put the exception message, but who cares ...
                }
            }
            // wait for X seconds
            sleep($interval);
        }
    }
}
//$pensPath="logopens.co.uk/skin/frontend/waterlee-boilerplate/penwarehouse/css/";
$pensPath = "../../../skin/frontend/waterlee-boilerplate/penwarehouse/css/";
$sass_watcher = new SassWatcher();
//$sass_watcher->watch("scss/", "css/", 1, "scssphp/scss.inc.php");
$sass_watcher->watch($pensPath . "scss/", $pensPath, 1, "scssphp/scss.inc.php");
コード例 #2
0
<?php

require "./lib/php-sass.php";
$sass_watcher = new SassWatcher("./lib/scss.inc.php");
$sass_watcher->compile_scss("../scss/", "../", 1, "scss_formatter_compressed");
コード例 #3
0
<?php

require "./lib/php-sass.php";
$sass_watcher = new SassWatcher("./lib/scss.inc.php");
$sass_watcher->watch("../scss/", "../", 2, "scss_formatter_compressed");