Merge pull request #30 from ahmadnazir/bootswatch
Add new theme: Bootswatch 'Reader' Theme Refactor asset rendering and grouping
This commit is contained in:
commit
3305c9d564
BIN
bin/md2resume
BIN
bin/md2resume
Binary file not shown.
|
@ -3,7 +3,7 @@
|
|||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
|
||||
],
|
||||
"hash": "c7a457f7ccfb1a6ec431bf89e1d4933c",
|
||||
"hash": "5f42fb6da16a9d26eb5a44694e6123a6",
|
||||
"packages": [
|
||||
{
|
||||
"name": "fabpot/php-cs-fixer",
|
||||
|
|
|
@ -68,6 +68,39 @@ 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
|
||||
|
@ -86,25 +119,9 @@ 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();
|
||||
$style = $this->generateContent($templatePath, 'css');
|
||||
|
||||
// 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();
|
||||
$links = $this->generateContent($templatePath, 'links');
|
||||
|
||||
$templateContent = file_get_contents($templateIndexPath);
|
||||
$resumeContent = file_get_contents($source);
|
||||
|
@ -126,6 +143,7 @@ class HtmlCommand extends Command
|
|||
$rendered = $m->render($templateContent, array(
|
||||
'title' => $title,
|
||||
'style' => $style,
|
||||
'links' => $links,
|
||||
'resume' => $resumeHtml,
|
||||
'reload' => (bool) $refresh,
|
||||
'refresh_rate' => $refresh
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Bootswatch 'readable' theme
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
{{#reload}}
|
||||
<meta http-equiv="refresh" content="{{refresh_rate}}">
|
||||
{{/reload}}
|
||||
|
||||
<title>{{title}}</title>
|
||||
|
||||
<body>
|
||||
|
||||
{{{resume}}}
|
||||
|
||||
</body>
|
||||
{{{links}}}
|
||||
</html>
|
|
@ -0,0 +1 @@
|
|||
<link href="//netdna.bootstrapcdn.com/bootswatch/3.1.1/readable/bootstrap.min.css" rel="stylesheet">
|
Loading…
Reference in New Issue