diff --git a/src/Resume/Command/HtmlCommand.php b/src/Resume/Command/HtmlCommand.php
index b64cc74..d0b4158 100644
--- a/src/Resume/Command/HtmlCommand.php
+++ b/src/Resume/Command/HtmlCommand.php
@@ -67,6 +67,37 @@ class HtmlCommand extends Command
return true;
}
+ protected function generateContent($templatePath, $contentType) {
+ // We build these into a single string so that we can deploy this resume as a
+ // single file.
+ $assetPath = join(DIRECTORY_SEPARATOR, array($templatePath, $contentType));
+
+ if (!file_exists($assetPath)) {
+ return '';
+ }
+
+ $assets = array();
+
+ // Our PHAR deployment can't handle the GlobAsset typically used here
+ foreach (new \DirectoryIterator($assetPath) as $fileInfo) {
+ if ($fileInfo->isDot() || !$fileInfo->isFile()) {
+ continue;
+ }
+ array_push($assets, new FileAsset($fileInfo->getPathname()));
+ }
+
+ $collection = new AssetCollection(
+ $assets
+ );
+
+ switch($contentType) {
+ case 'css':
+ $collection->ensureFilter(new Filter\LessphpFilter());
+ break;
+ }
+ return $collection->dump();
+ }
+
protected function generateHtml($source, $template, $refresh)
{
// Check that the source file is sane
@@ -85,25 +116,7 @@ class HtmlCommand extends Command
throw new \Exception("Unable to open template file: $templateIndexPath");
}
- // We build these into a single string so that we can deploy this resume as a
- // single file.
- $cssAssetPath = join(DIRECTORY_SEPARATOR, array($templatePath, '/css'));
- $cssAssets = array();
-
- // Our PHAR deployment can't handle the GlobAsset typically used here
- foreach (new \DirectoryIterator($cssAssetPath) as $fileInfo) {
- if ($fileInfo->isDot() || !$fileInfo->isFile()) {
- continue;
- }
- array_push($cssAssets, new FileAsset($fileInfo->getPathname()));
- }
-
- $css = new AssetCollection(
- $cssAssets,
- array(new Filter\LessphpFilter())
- );
-
- $style = $css->dump();
+ $style = $this->generateContent($templatePath, 'css');
$templateContent = file_get_contents($templateIndexPath);
$resumeContent = file_get_contents($source);