/** * Compile the .scss files * * @param string $inputFile * @param string $outputFile * * @return boolean */ protected function _autoCompileSass($inputFile, $outputFile) { $cacheFile = str_replace(DS, '_', str_replace(APP, null, $outputFile)); $cacheFile = $this->_cacheFolder . DS . $cacheFile; $cacheFile = substr_replace($cacheFile, 'cache', -3); $cache = file_exists($cacheFile) ? unserialize(file_get_contents($cacheFile)) : $inputFile; if (!self::$_instance instanceof SassCompiler) { self::$_instance = new SassCompiler(); self::$_instance->registerHelper('CompassUrl'); self::$_instance->registerHelper('CompassImageDimension'); self::$_instance->registerHelper('CompassConstant'); self::$_instance->registerHelper('CompassMath'); self::$_instance->registerHelper('CompassFontFiles'); self::$_instance->registerHelper('CompassInlineData'); self::$_instance->registerHelper('CompassSprite'); self::$_instance->setFormatter($this->settings['formatter']); $paths = array(); foreach ($this->_sassFolders as $folder) { foreach ($this->settings['import_paths'] as $path) { if ($fullPath = realpath($folder->path . DS . $path)) { $paths[] = $fullPath; } } } self::$_instance->setImportPaths($paths); } $newCache = self::$_instance->cachedCompile($cache, $this->settings['forceCompiling']); if (true === $this->settings['forceCompiling'] || !is_array($cache) || $newCache["updated"] > $cache["updated"]) { file_put_contents($cacheFile, serialize($newCache)); file_put_contents($outputFile, $newCache['compiled']); return true; } return false; }
public function initialize() { if ($this->app['config']->get('general/debug')) { // get the active theme. $theme = $this->app['config']->get('general/theme'); $formatter = $this->config['formatter']; \SassCompiler::run('theme/' . $theme . '/scss/', 'theme/' . $theme . '/css/', $formatter); } }
public function output($filename, $contents) { $filename = basename($filename); $tmp_file = ROOT . $this->settings['pre_process_dir'] . $filename; file_put_contents($tmp_file, $contents); $file_parts = explode('.', $filename); $compiled_file = ROOT . $this->settings['post_process_dir'] . $file_parts[0] . '.css'; \SassCompiler::run(ROOT . $this->settings['pre_process_dir'], ROOT . $this->settings['post_process_dir']); if (file_exists($compiled_file)) { $contents = file_get_contents($compiled_file); //unlink($compiled_file); } return $contents; }
public function fire() { SassCompiler::run("public/scss/", "public/css/"); }
<?php /** * A simple PHP MVC skeleton * * @package php-mvc * @author Panique * @link http://www.php-mvc.net * @link https://github.com/panique/php-mvc/ * @license http://opensource.org/licenses/MIT MIT License */ // load the (optional) Composer auto-loader if (file_exists('vendor/autoload.php')) { require 'vendor/autoload.php'; } // load application config (error reporting etc.) require 'application/config/config.php'; // load application class require 'application/libs/application.php'; require 'application/libs/controller.php'; // run the scss compiler every you the application is hit (in development) // TODO: build a switch for development/production SassCompiler::run("public/scss/", "public/css/"); // start the application $app = new Application();
error_reporting(E_ALL); ini_set("display_errors", 1); // Load Composer's PSR-4 autoloader (necessary to load Slim, Mini etc.) require '../vendor/autoload.php'; // Initialize Slim (the router/micro framework used). $app = new \Slim\Slim(); // and define the engine used for the view @see http://twig.sensiolabs.org $app->view = new \Slim\Views\Twig(); $app->view->setTemplatesDirectory("../Mini/view"); /******************************************* THE CONFIGS *******************************************************/ // Configs for mode "development" (Slim's default), see the GitHub readme for details on setting the environment $app->configureMode('development', function () use($app) { // pre-application hook, performs stuff before real action happens @see http://docs.slimframework.com/#Hooks $app->hook('slim.before', function () use($app) { // SASS-to-CSS compiler @see https://github.com/panique/php-sass SassCompiler::run("scss/", "css/"); // CSS minifier @see https://github.com/matthiasmullie/minify $minifier = new MatthiasMullie\Minify\CSS('css/style.css'); $minifier->minify('css/style.css'); // JS minifier @see https://github.com/matthiasmullie/minify // DON'T overwrite your real .js files, always save into a different file //$minifier = new MatthiasMullie\Minify\JS('js/application.js'); //$minifier->minify('js/application.minified.js'); }); // Set the configs for development environment $app->config(array('debug' => true, 'database' => array('db_host' => 'localhost', 'db_port' => '', 'db_name' => 'scdm', 'db_user' => 'root', 'db_pass' => ''))); }); // Configs for mode "production" $app->configureMode('production', function () use($app) { // Set the configs for production environment $app->config(array('debug' => false, 'database' => array('db_host' => '', 'db_port' => '', 'db_name' => '', 'db_user' => '', 'db_pass' => '')));
public function register($app) { \SassCompiler::run(scss_path() . '/', public_path() . "/css/"); }
/** * Execute the console command. * * @return mixed */ public function fire() { $sass_source_dir = base_path() . '/resources/scss/'; $css_target_dir = base_path() . '/public/vendor/bootstrap/css/'; \SassCompiler::run($sass_source_dir, $css_target_dir); }
require __DIR__ . '/../bootstrap/autoload.php'; /* |-------------------------------------------------------------------------- | Turn On The Lights |-------------------------------------------------------------------------- | | We need to illuminate PHP development, so let us turn on the lights. | This bootstraps the framework and gets it ready for use, then it | will load up this application so that we can run it and send | the responses back to the browser and delight our users. | */ $app = (require_once __DIR__ . '/../bootstrap/app.php'); /* |-------------------------------------------------------------------------- | Run The Application |-------------------------------------------------------------------------- | | Once we have the application, we can handle the incoming request | through the kernel, and send the associated response back to | the client's browser allowing them to enjoy the creative | and wonderful application we have prepared for them. | */ SassCompiler::run("resources/assets/sass/", "public/css/"); // some people said this does not work in their installation, so if you have trouble, try these paths: // SassCompiler::run("public/scss/", "public/css/"); $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); $response = $kernel->handle($request = Illuminate\Http\Request::capture()); $response->send(); $kernel->terminate($request, $response);
} else { $message = ["type" => "error", "title" => "Missing Parameter", "body" => "The sort sequence hasn't been initialized. Please try again."]; } } else { $message = ["type" => "error", "title" => "Invalid Action", "body" => "We didn't recognize what you wanted us to do. Care to try again? "]; } } } } } } // handle automatic rebuild cycle from GET if (isset($_GET["action"]) && $_GET["action"] == "autocycle") { // perform complete cycle purge(); SassCompiler::run("scss/", "css/", "scss_formatter_compressed"); combine(); purge(); // return contents of app.css header("Content-Type: text/css"); $file = fopen("app.css", "r"); while ($line = fgets($file)) { print $line; } fclose($file); } // fetch all css files $files = []; foreach (glob("css/*.css") as $css) { $files[] = ["name" => substr($css, 4, -4), "timestamp" => date("j F Y, H:i:s", filemtime($css))]; }
| for our application. We just need to utilize it! We'll require it | into the script here so that we do not have to worry about the | loading of any our classes "manually". Feels great to relax. | */ require __DIR__ . '/../bootstrap/autoload.php'; /* |-------------------------------------------------------------------------- | Turn On The Lights |-------------------------------------------------------------------------- | | We need to illuminate PHP development, so let's turn on the lights. | This bootstraps the framework and gets it ready for use, then it | will load up this application so that we can run it and send | the responses back to the browser and delight these users. | */ $app = (require_once __DIR__ . '/../bootstrap/start.php'); SassCompiler::run("app/assets/scss/", "public/compiled-css/"); /* |-------------------------------------------------------------------------- | Run The Application |-------------------------------------------------------------------------- | | Once we have the application, we can simply call the run method, | which will execute the request and send the response back to | the client's browser allowing them to enjoy the creative | and wonderful application we have whipped up for them. | */ $app->run();