private _generateExampleTabs()

in src/app/shared/example-viewer/example-viewer.ts [211:238]


  private _generateExampleTabs() {
    this.exampleTabs = {};

    if (this.exampleData) {
      // Name of the default example files. If files with such name exist within the example,
      // we provide a shorthand for them within the example tabs (for less verbose tabs).
      const exampleBaseFileName = `${this.example}-example`;
      const docsContentPath = `/docs-content/examples-highlighted/${this.exampleData.packagePath}`;


      for (const fileName of this.exampleData.files) {
        // Since the additional files refer to the original file name, we need to transform
        // the file name to match the highlighted HTML file that displays the source.
        const fileSourceName = fileName.replace(fileExtensionRegex, '$1-$2.html');
        const importPath = `${docsContentPath}/${fileSourceName}`;

        if (fileName === `${exampleBaseFileName}.ts`) {
          this.exampleTabs['TS'] = importPath;
        } else if (fileName === `${exampleBaseFileName}.css`) {
          this.exampleTabs['CSS'] = importPath;
        } else if (fileName === `${exampleBaseFileName}.html`) {
          this.exampleTabs['HTML'] = importPath;
        } else {
          this.exampleTabs[fileName] = importPath;
        }
      }
    }
  }