diff --git a/esbuild.config.mjs b/esbuild.config.mjs index 025dd2f..7f18d80 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -39,6 +39,14 @@ const context = await esbuild.context({ logLevel: "info", sourcemap: prod ? false : "inline", treeShaking: true, + plugins: [ + copy({ + assets: { + from: ['node_modules/@marp-team/marp-cli/lib/*'], + to: ['./lib/'], + } + }) + ], //outfile: "vault/.obsidian/plugins/marp-slides/main.js", //for local dev!!! outfile: "main.js", }); diff --git a/src/utilities/filePath.ts b/src/utilities/filePath.ts index 3ef34b5..8085e65 100644 --- a/src/utilities/filePath.ts +++ b/src/utilities/filePath.ts @@ -10,6 +10,7 @@ export class FilePath { } private getRootPath(file: TFile): string { + let basePath = (file.vault.adapter as FileSystemAdapter).getBasePath(); if (basePath.startsWith('/')){ basePath = `/${normalizePath(basePath)}`; @@ -18,25 +19,25 @@ export class FilePath { { basePath = normalizePath(basePath); } - //console.log(`Root Path: ${basePath}`); + console.log(`Root Path: ${basePath}`); return basePath; } getCompleteFileBasePath(file: TFile): string{ const resourcePath = (file.vault.adapter as FileSystemAdapter).getResourcePath(normalizePath(file.parent.path)).split("?"); - //console.log(`Complete File Base Path: ${resourcePath}`); + console.log(`Complete File Base Path: ${resourcePath}`); return `${resourcePath[0]}/`; } getCompleteFilePath(file: TFile) : string{ const basePath = `${this.getRootPath(file)}/${normalizePath(file.path)}`; - //console.log(`Complete File Path: ${basePath}`); + console.log(`Complete File Path: ${basePath}`); return basePath; } getThemePath(file: TFile): string{ const themePath = `${this.getRootPath(file)}/${normalizePath(this.settings.ThemePath)}`; - //console.log(`Theme Path: ${themePath}`); + console.log(`Theme Path: ${themePath}`); if (this.settings.ThemePath != ''){ return themePath; } @@ -49,14 +50,14 @@ export class FilePath { private getPluginDirectory(vault: Vault): string { const fileSystem = vault.adapter as FileSystemAdapter; const path = normalizePath(`${fileSystem.getBasePath()}/${vault.configDir}/plugins/marp-slides`) + '/'; - //console.log(path); + console.log(path); return path; } - getLibDirectory(vault: Vault): string { + public getLibDirectory(vault: Vault): string { const pluginDirectory = this.getPluginDirectory(vault); const path = normalizePath(`${pluginDirectory}lib`) + '/'; - //console.log(path); + console.log(path); return path; } } \ No newline at end of file