build(docs-infra): replace base64 images for stackblitz by svgs (#48774)

PNG converted to base64 don't work on stackblitz.
As stackblitz does't support binary files for dynamicaly created projects, we now use only svgs.

Fixes: #48773

PR Close #48774
This commit is contained in:
Matthieu Riegler
2023-01-19 10:11:13 +01:00
committed by Jessica Janiuk
parent a63983d1ba
commit 82c8b7ae9e
26 changed files with 1241 additions and 25 deletions
+2 -7
View File
@@ -1,7 +1,7 @@
// Canonical path provides a consistent path (i.e. always forward slashes) across different OSes
import path from 'canonical-path';
import fs from 'fs-extra';
import {globbySync} from 'globby';
import { globbySync } from 'globby';
import jsdom from 'jsdom';
import regionExtractor from '../transforms/examples-package/services/region-parser.js';
@@ -182,12 +182,7 @@ export class StackblitzBuilder {
config.fileNames.forEach((fileName) => {
let content;
const extn = path.extname(fileName);
if (extn === '.png') {
content = this._encodeBase64(fileName);
fileName = `${fileName.slice(0, -extn.length)}.base64${extn}`;
} else {
content = fs.readFileSync(fileName, 'utf-8');
}
content = fs.readFileSync(fileName, 'utf-8');
if (extn === '.js' || extn === '.ts' || extn === '.css') {
content = content + this.copyrights.jsCss;