/** * Set-up default vars */ public static function init() { // make sure config vars exist if (!Config::getOption("patternExtension")) { Console::writeError("the pattern extension config option needs to be set..."); } if (!Config::getOption("styleguideKit")) { Console::writeError("the styleguideKit config option needs to be set..."); } // set-up config vars $patternExtension = Config::getOption("patternExtension"); $pluginDir = Config::getOption("packagesDir"); $sourceDir = Config::getOption("sourceDir"); $styleguideKit = Config::getOption("styleguideKit"); // load pattern-lab's resources $partialPath = $pluginDir . "/" . $styleguideKit . "/views/partials"; self::$htmlHead = file_get_contents($partialPath . "/general-header." . $patternExtension); self::$htmlFoot = file_get_contents($partialPath . "/general-footer." . $patternExtension); // gather the user-defined header and footer information $patternHeadPath = $sourceDir . "/_meta/_00-head." . $patternExtension; $patternFootPath = $sourceDir . "/_meta/_01-foot." . $patternExtension; self::$patternHead = file_exists($patternHeadPath) ? file_get_contents($patternHeadPath) : ""; self::$patternFoot = file_exists($patternFootPath) ? file_get_contents($patternFootPath) : ""; // add the filesystemLoader $patternEngineBasePath = PatternEngine::getInstance()->getBasePath(); $filesystemLoaderClass = $patternEngineBasePath . "\\Loaders\\FilesystemLoader"; $options = array(); $options["templatePath"] = $pluginDir . "/" . $styleguideKit . "/views"; $options["partialsPath"] = $pluginDir . "/" . $styleguideKit . "/views/partials"; self::$filesystemLoader = new $filesystemLoaderClass($options); $stringLoaderClass = $patternEngineBasePath . "\\Loaders\\StringLoader"; self::$stringLoader = new $stringLoaderClass(); // i can't remember why i chose to implement the pattern loader directly in classes // i figure i had a good reason which is why it's not showing up here }
/** * Set-up default vars */ public static function init() { // make sure config vars exist if (!Config::getOption("patternExtension")) { Console::writeError("the pattern extension config option needs to be set..."); } if (!Config::getOption("styleguideKit")) { Console::writeError("the styleguideKit config option needs to be set..."); } // set-up config vars $patternExtension = Config::getOption("patternExtension"); $metaDir = Config::getOption("metaDir"); $styleguideKit = Config::getOption("styleguideKit"); $styleguideKitPath = Config::getOption("styleguideKitPath"); if (!$styleguideKitPath || !is_dir($styleguideKitPath)) { Console::writeError("your styleguide won't render because i can't find your styleguide files. are you sure they're at <path>" . Console::getHumanReadablePath($styleguideKitPath) . "</path>? you can fix this in <path>./config/config.yml</path> by editing styleguideKitPath..."); } // load pattern-lab's resources $partialPath = $styleguideKitPath . DIRECTORY_SEPARATOR . "views" . DIRECTORY_SEPARATOR . "partials"; $generalHeaderPath = $partialPath . DIRECTORY_SEPARATOR . "general-header." . $patternExtension; $generalFooterPath = $partialPath . DIRECTORY_SEPARATOR . "general-footer." . $patternExtension; self::$htmlHead = file_exists($generalHeaderPath) ? file_get_contents($generalHeaderPath) : ""; self::$htmlFoot = file_exists($generalFooterPath) ? file_get_contents($generalFooterPath) : ""; // gather the user-defined header and footer information $patternHeadPath = $metaDir . DIRECTORY_SEPARATOR . "_00-head." . $patternExtension; $patternFootPath = $metaDir . DIRECTORY_SEPARATOR . "_01-foot." . $patternExtension; self::$patternHead = file_exists($patternHeadPath) ? file_get_contents($patternHeadPath) : ""; self::$patternFoot = file_exists($patternFootPath) ? file_get_contents($patternFootPath) : ""; // add the filesystemLoader $patternEngineBasePath = PatternEngine::getInstance()->getBasePath(); $filesystemLoaderClass = $patternEngineBasePath . "\\Loaders\\FilesystemLoader"; $options = array(); $options["templatePath"] = $styleguideKitPath . DIRECTORY_SEPARATOR . "views"; $options["partialsPath"] = $options["templatePath"] . DIRECTORY_SEPARATOR . "partials"; self::$filesystemLoader = new $filesystemLoaderClass($options); $stringLoaderClass = $patternEngineBasePath . "\\Loaders\\StringLoader"; self::$stringLoader = new $stringLoaderClass(); // i can't remember why i chose to implement the pattern loader directly in classes // i figure i had a good reason which is why it's not showing up here }