mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-07-19 05:09:41 +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
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "codex.docs",
|
"name": "codex.docs",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"version": "v2.2.0-rc.1",
|
"version": "v2.2.0-rc.11",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"bin": {
|
"bin": {
|
||||||
"codex.docs": "dist/backend/app.js"
|
"codex.docs": "dist/backend/app.js"
|
||||||
|
|
|
@ -45,8 +45,10 @@ export default async function buildStatic(): Promise<void> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Removing old static files');
|
if (config.overwrite) {
|
||||||
await fse.remove(distPath);
|
console.log('Removing old static files');
|
||||||
|
await fse.remove(distPath);
|
||||||
|
}
|
||||||
|
|
||||||
console.log('Building static files');
|
console.log('Building static files');
|
||||||
const pagesOrder = await PagesOrder.getAll();
|
const pagesOrder = await PagesOrder.getAll();
|
||||||
|
@ -118,11 +120,22 @@ export default async function buildStatic(): Promise<void> {
|
||||||
console.log('Static files built');
|
console.log('Static files built');
|
||||||
|
|
||||||
console.log('Copy public directory');
|
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') {
|
if (appConfig.uploads.driver === 'local') {
|
||||||
console.log('Copy uploads directory');
|
console.log('Copy uploads directory');
|
||||||
await fse.copy(path.resolve(cwd, appConfig.uploads.local.path), path.resolve(distPath, 'uploads'));
|
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({
|
const StaticBuildConfig = z.object({
|
||||||
outputDir: z.string(), // Output directory for static build
|
outputDir: z.string(), // Output directory for static build
|
||||||
|
overwrite: z.boolean().optional().default(true),
|
||||||
indexPage: z.object({
|
indexPage: z.object({
|
||||||
enabled: z.boolean(), // Is index page enabled
|
enabled: z.boolean(), // Is index page enabled
|
||||||
uri: z.string(), // Index page uri
|
uri: z.string(), // Index page uri
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="block-code__content">{{ code | escape }}</div>
|
<div class="block-code__content">{{ code | escape }}</div>
|
||||||
</div>
|
</div>
|
||||||
{%
|
{%
|
||||||
include 'components/copy-button.twig' with {
|
include '../../components/copy-button.twig' with {
|
||||||
ariaLabel: 'Copy Code to Clipboard',
|
ariaLabel: 'Copy Code to Clipboard',
|
||||||
class: 'block-code__copy-button',
|
class: 'block-code__copy-button',
|
||||||
textToCopy: code | escape,
|
textToCopy: code | escape,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<h{{ level }} id="{{ text | urlify }}" class="block-header block-header--{{ level }}">
|
<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,
|
ariaLabel: 'Copy Link to the ' ~ text,
|
||||||
class: 'block-header__copy-button',
|
class: 'block-header__copy-button',
|
||||||
textToCopy: '#' ~ text | urlify,
|
textToCopy: '#' ~ text | urlify,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue