mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-07-18 20:59:42 +02:00
Fixed copy button path in header.twig, code.twig (#290)
* Fixed copy button path in header.twig * Fixed path of copy button in code.twig, updated version * add more logs * Added overwrite property * update version Co-authored-by: Nikita Melnikov <nikmel2803@gmail.com>
This commit is contained in:
parent
d3e0cb176c
commit
f78b9ecff5
5 changed files with 20 additions and 6 deletions
|
@ -45,8 +45,10 @@ export default async function buildStatic(): Promise<void> {
|
|||
});
|
||||
}
|
||||
|
||||
console.log('Removing old static files');
|
||||
await fse.remove(distPath);
|
||||
if (config.overwrite) {
|
||||
console.log('Removing old static files');
|
||||
await fse.remove(distPath);
|
||||
}
|
||||
|
||||
console.log('Building static files');
|
||||
const pagesOrder = await PagesOrder.getAll();
|
||||
|
@ -118,11 +120,22 @@ export default async function buildStatic(): Promise<void> {
|
|||
console.log('Static files built');
|
||||
|
||||
console.log('Copy public directory');
|
||||
await fse.copy(path.resolve(dirname, '../../public'), distPath);
|
||||
const publicDir = path.resolve(dirname, '../../public');
|
||||
|
||||
console.log(`Copy from ${publicDir} to ${distPath}`);
|
||||
|
||||
try {
|
||||
await fse.copy(publicDir, distPath);
|
||||
console.log('Public directory copied');
|
||||
} catch (e) {
|
||||
console.log('Error while copying public directory');
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
if (appConfig.uploads.driver === 'local') {
|
||||
console.log('Copy uploads directory');
|
||||
await fse.copy(path.resolve(cwd, appConfig.uploads.local.path), path.resolve(distPath, 'uploads'));
|
||||
console.log('Uploads directory copied');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,6 +90,7 @@ const FrontendConfig = z.object({
|
|||
*/
|
||||
const StaticBuildConfig = z.object({
|
||||
outputDir: z.string(), // Output directory for static build
|
||||
overwrite: z.boolean().optional().default(true),
|
||||
indexPage: z.object({
|
||||
enabled: z.boolean(), // Is index page enabled
|
||||
uri: z.string(), // Index page uri
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div class="block-code__content">{{ code | escape }}</div>
|
||||
</div>
|
||||
{%
|
||||
include 'components/copy-button.twig' with {
|
||||
include '../../components/copy-button.twig' with {
|
||||
ariaLabel: 'Copy Code to Clipboard',
|
||||
class: 'block-code__copy-button',
|
||||
textToCopy: code | escape,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<h{{ level }} id="{{ text | urlify }}" class="block-header block-header--{{ level }}">
|
||||
{%
|
||||
include 'components/copy-button.twig' with {
|
||||
include '../../components/copy-button.twig' with {
|
||||
ariaLabel: 'Copy Link to the ' ~ text,
|
||||
class: 'block-header__copy-button',
|
||||
textToCopy: '#' ~ text | urlify,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue