public function action_sass() { header("Content-type: text/css"); header("Pragma: public"); header("Cache-Control: no-cache, must-revalidate"); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); # output directly to battle-test this sucka echo sass::stylesheet('advanced', 'nested'); die; }
/** * Handler * * @param mixed $files * @param boolean $style of the output * @return string */ private static function handler($files, $style) { // set variables self::$cache_folder = Kohana::config('kosass.cache_folder'); // if files is not an array convert to one if (!is_array($files)) { $files = array($files); } // set files self::$files = $files; // add absolute path to file names self::get_files_path(); // load cache library $cache = new Kohaml_Cache('kosass'); // check for debug $debug = FALSE; //Kohana::config('kosass.debug'); // init Kosass $kosass = new Kosass($style, $debug); // loop files foreach (self::$files as $file) { // add cache file name self::$cache_files[] = $cache->check($file); $name = basename($file, '.' . Kohana::config('kosass.ext')); // if cache file does not exists then cache output from Kohaml if (!$cache->skip() || $debug) { // put file contents into an array then pass to render $output = $kosass->compile(file($file), $name); // cache output if (!$debug) { $cache->cache($output); } } } // destroy static variables self::destruct(); }
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Version history v 1.0: initial release V1.1: Automatically guess wordpress configurations options: - Is not theme specific anymore: , and allows to work on */ /*===settings ==*/ //Path to SASS class and SCSS $SASS_BASE = $_SERVER['DOCUMENT_ROOT'] . "/sass/"; //Allows to work on a specific theme instead of the current one. $specific = ''; //automatically guess the theme in use $projectName = $specific == '' ? strtolower(get_current_theme()) : $specific; //css file name without extension $CSSName = "responsive"; //Retrieve current path $base = dirname($_SERVER['DOCUMENT_ROOT'] . $_SERVER['PHP_SELF']); //destination path for the generated CSS $destination = str_replace('/var/www/', '', $base) . "/wp-content/themes/{$projectName}/css/"; //Check if the SCSS folder exists if (file_exists($SASS_BASE . 'project/' . $projectName)) { require $SASS_BASE . "class/class_sass.php"; require $SASS_BASE . "class/class_reordercss.php"; $SASS = new sass($projectName, $CSSName, $destination); $SASS->wp_sass(); }