/** * Get the full path to a style guide template * * @param string $template The relative path of the template * @return string The full template path */ protected function getStyleguideTemplatePath($template) { return PatternLab::makePath([$this->patternlab->getStyleguideTemplatesDirectory(), $template]); }
protected function makePath($path) { $path = (array) $path; array_unshift($path, $this->root); return PatternLab::makePath($path); }
public function __construct($dir) { $configPath = PatternLab::makePath([$dir, 'config', 'config.yml']); if (is_file($configPath)) { $seConfig = Yaml::parse(file_get_contents($configPath)); if (!empty($seConfig['sourceDir'])) { $sourceDir = PatternLab::makePath([$dir, $seConfig['sourceDir']]); if (is_dir($sourceDir)) { $this->addAssetDirectory($sourceDir); $patternsDir = PatternLab::makePath([$sourceDir, '_patterns']); if (is_dir($patternsDir)) { $this->setPatternsDirectory($patternsDir); } $dataDir = PatternLab::makePath([$sourceDir, '_data']); if (is_dir($dataDir)) { foreach (glob(PatternLab::makePath([$dataDir, '*.json'])) as $path) { if (basename($path) == 'listitems.json') { $this->addListItems($path); } else { $this->addGlobalData($path); } } } $annotationsPath = PatternLab::makePath([$sourceDir, '_annotations', 'annotations.js']); if (is_file($annotationsPath)) { $this->setAnnotationsFile($annotationsPath); } $headerPath = PatternLab::makePath([$sourceDir, '_meta', '_00-head.twig']); if (is_file($headerPath)) { $this->setStyleguideHeader($headerPath); } $footerPath = PatternLab::makePath([$sourceDir, '_meta', '_01-foot.twig']); if (is_file($footerPath)) { $this->setStyleguideFooter($footerPath); } } } if (!empty($seConfig['packagesDir'])) { $packagesDir = PatternLab::makePath([$dir, $seConfig['packagesDir']]); if (is_dir($packagesDir)) { $assetsDir = PatternLab::makePath([$packagesDir, 'pattern-lab', 'styleguidekit-assets-default', 'dist']); if (is_dir($assetsDir)) { $this->addStyleguideAssetDirectory($assetsDir); } if (!empty($seConfig['styleguideKit'])) { $templatesDir = PatternLab::makePath([$packagesDir, $seConfig['styleguideKit'], 'views']); if (is_dir($templatesDir)) { $this->setStyleguideTemplatesDirectory($templatesDir); } } } } if (!empty($seConfig['id'])) { $this->setIgnoredDirectories($seConfig['id']); } if (!empty($seConfig['ie'])) { $this->setIgnoredExtensions($seConfig['ie']); } if (!empty($seConfig['ishControlsHide'])) { $this->setHiddenControls($seConfig['ishControlsHide']); } if (!empty($seConfig['patternExtension'])) { $this->setPatternExtension($seConfig['patternExtension']); } } }
public function makePath(SourcePattern $pattern) { $path = Navigation::escapePath($pattern->getPath()); return PatternLab::makePath([$path, "{$path}.html"]); }
protected function makePaths(SourcePatternInterface $pattern) { $path = preg_replace('|[\\\\/~]|', '-', $pattern->getPath()); $this->escapedSourcePath = PatternLab::makePath(['patterns', $path, "{$path}.escaped.html"]); $this->path = PatternLab::makePath([$path, "{$path}.html"]); $this->pagePath = PatternLab::makePath(['patterns', $this->path]); $this->sourcePath = PatternLab::makePath(['patterns', $path, "{$path}.pattern.html"]); $this->templatePath = PatternLab::makePath(['patterns', $path, "{$path}.twig"]); $this->lineagePath = PatternLab::makePath(['..', '..', $this->pagePath]); }
protected function makePath($path) { return PatternLab::makePath([$this->path, $path]); }