diff --git a/src/app/application.ts b/src/app/application.ts index 39b72625..73e69b46 100644 --- a/src/app/application.ts +++ b/src/app/application.ts @@ -2544,7 +2544,7 @@ at least one config for the 'info' or 'source' tab in --navTabConfig.`); // tslint:disable-line if (errorCopyFavicon) { logger.error( - 'Error during resources copy ', + 'Error during resources copy of favicon', errorCopyFavicon ); } else { @@ -2555,6 +2555,30 @@ at least one config for the 'info' or 'source' tab in --navTabConfig.`); } else { onComplete(); } + if (this.configuration.mainData.customLogo !== '') { + logger.info(`Custom logo supplied`); + fs.copy( + path.resolve( + process.cwd() + + path.sep + + this.configuration.mainData.customLogo + ), + path.resolve(finalOutput + '/images/logo.png'), + errorCopyLogo => { + // tslint:disable-line + if (errorCopyLogo) { + logger.error( + 'Error during resources copy of logo', + errorCopyLogo + ); + } else { + onComplete(); + } + } + ); + } else { + onComplete(); + } } } } diff --git a/src/app/configuration.ts b/src/app/configuration.ts index c87721f5..a4a81183 100644 --- a/src/app/configuration.ts +++ b/src/app/configuration.ts @@ -68,6 +68,7 @@ export class Configuration implements ConfigurationInterface { exportFormat: COMPODOC_DEFAULTS.exportFormat, coverageData: {}, customFavicon: '', + customLogo: '', packageDependencies: [], packagePeerDependencies: [], gaID: '', diff --git a/src/app/interfaces/main-data.interface.ts b/src/app/interfaces/main-data.interface.ts index a9505a77..3f17eb06 100644 --- a/src/app/interfaces/main-data.interface.ts +++ b/src/app/interfaces/main-data.interface.ts @@ -63,6 +63,7 @@ export interface MainDataInterface { exportFormat: string; coverageData: Object; customFavicon: string; + customLogo: string; packageDependencies: Object[]; packagePeerDependencies: Object[]; gaID: string; diff --git a/src/config/schema.json b/src/config/schema.json index 1b6cf07a..d9a2d6f5 100644 --- a/src/config/schema.json +++ b/src/config/schema.json @@ -342,6 +342,15 @@ "" ] }, + "customLogo": { + "$id": "/properties/customLogo", + "type": "string", + "title": "Use a custom logo", + "default": "", + "examples": [ + "" + ] + }, "gaID": { "$id": "/properties/gaID", "type": "string", diff --git a/src/index-cli.ts b/src/index-cli.ts index af36fe86..afd2ead8 100644 --- a/src/index-cli.ts +++ b/src/index-cli.ts @@ -159,6 +159,7 @@ Note: Certain tabs will only be shown if applicable to a given dependency`, false ) .option('--customFavicon [path]', 'Use a custom favicon') + .option('--customLogo [path]', 'Use a custom logo') .option('--gaID [id]', 'Google Analytics tracking ID') .option('--gaSite [site]', 'Google Analytics site name', COMPODOC_DEFAULTS.gaSite) .parse(process.argv); @@ -477,6 +478,13 @@ Note: Certain tabs will only be shown if applicable to a given dependency`, this.configuration.mainData.customFavicon = program.customFavicon; } + if (configFile.customLogo) { + this.configuration.mainData.customLogo = configFile.customLogo; + } + if (program.customLogo) { + this.configuration.mainData.customLogo = program.customLogo; + } + if (configFile.gaID) { this.configuration.mainData.gaID = configFile.gaID; } diff --git a/src/templates/partials/menu.hbs b/src/templates/partials/menu.hbs index f0d8f508..baf97bdd 100644 --- a/src/templates/partials/menu.hbs +++ b/src/templates/partials/menu.hbs @@ -14,8 +14,15 @@ customElements.define('compodoc-menu', class extends HTMLElement { let tp = lithtml.html(`