Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
samwilson committed Jan 15, 2025
1 parent 3290169 commit b90e24c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 84 deletions.
3 changes: 3 additions & 0 deletions docs/content/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ will be copied to `output/`.
("Non-page" means anything with a file extension that
doesn't match the default as defined by the `ext` key in `basildon.yaml`.)

Images (and other files) can be in either the `assets/` or `content/` directories,
depending on how they're used in the site.

## Output

All output is in the `output/` directory of a site.
Expand Down
75 changes: 0 additions & 75 deletions docs/content/style.css

This file was deleted.

2 changes: 1 addition & 1 deletion docs/templates/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{page.metadata.title}}: {{page.metadata.subtitle}}</title>
<link rel="stylesheet" href="{{ page.link('/assets/style.css') }}" />
<link rel="stylesheet" href="{{ page.link('/style.css') }}" />
</head>
<body>
<header>
Expand Down
17 changes: 9 additions & 8 deletions src/Command/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$files->files()
->in($dir . '/content')
->notName('*' . $site->getExt());
$this->copyFilesToOutput($dir, $files);
$this->copyFilesToOutput($dir . '/content', $dir . '/output', $files);

// Copy all assets.
// @TODO Add processing (LESS etc.).
Expand All @@ -130,7 +130,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$assets->files()
->in($assetsDir)
->name('/.*\.(css|js|jpg|png|gif|svg|pdf)/');
$this->copyFilesToOutput($dir, $assets);
$this->copyFilesToOutput($assetsDir, $dir . '/output', $assets);
}

// Report build details.
Expand All @@ -148,16 +148,17 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

/**
* @param string $dir Full filesystem path to the site directory.
* @param string $inDir Full filesystem path of the source directory, with no trailing slash.
* @param string $outDir Full filesystem path of the destination directory, with no trailing slash.
* @param Finder $files The files to copy.
*/
private function copyFilesToOutput(string $dir, Finder $files): void
private function copyFilesToOutput(string $inDir, string $outDir, Finder $files): void
{
foreach ($files as $file) {
$fileRelativePath = substr($file->getRealPath(), strlen($dir . '/content'));
self::writeln('Copying content file: ' . $fileRelativePath);
Util::mkdir(dirname($dir . '/output' . $fileRelativePath));
copy($file->getRealPath(), $dir . '/output' . $fileRelativePath);
$fileRelativePath = substr($file->getRealPath(), strlen($inDir));
self::writeln('Copying file: ' . $fileRelativePath);
Util::mkdir(dirname($outDir . $fileRelativePath));
copy($file->getRealPath(), $outDir . $fileRelativePath);
}
}
}

0 comments on commit b90e24c

Please sign in to comment.