Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extensions - Properly copy project resources from extensions #8424

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions news/changelog-1.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All changes included in 1.5:

- ([#8118](https://github.com/quarto-dev/quarto-cli/issues/8118)): Add support for `body-classes` to add classes to the document body.

## Extensions

- ([#8385](https://github.com/quarto-dev/quarto-cli/issues/8385)): Properly copy project resources when extensions are installed at project level.

## Other Fixes

- ([#8119](https://github.com/quarto-dev/quarto-cli/issues/8119)): More intelligently detect when ejs templates are modified during development, improving quality of life during preview.
11 changes: 9 additions & 2 deletions src/extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ export function createExtensionContext(): ExtensionContext {
// _extensions/confluence/logo.png
// will be copied and resolved to:
// site_lib/quarto-contrib/quarto-project/confluence/logo.png
export function projectExtensionPathResolver(libDir: string) {
export function projectExtensionPathResolver(
libDir: string,
projectDir: string,
) {
return (href: string, projectOffset: string) => {
const projectRelativeHref = relative(projectOffset, href);

Expand All @@ -150,7 +153,11 @@ export function projectExtensionPathResolver(libDir: string) {
`${libDir}/quarto-contrib/quarto-project/`,
);

copyResourceFile(".", projectRelativeHref, projectTargetHref);
copyResourceFile(
projectDir,
join(projectDir, projectRelativeHref),
join(projectDir, projectTargetHref),
);
return join(projectOffset, projectTargetHref);
}

Expand Down
1 change: 1 addition & 0 deletions src/project/types/website/website.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export const websiteProjectType: ProjectType = {
project,
projectExtensionPathResolver(
project.config?.project[kProjectLibDir] || "",
project.dir,
),
),
]);
Expand Down
Loading