mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-17 03:00:13 +00:00
Trick to avoid duplicating the SVG in the source
This commit is contained in:
@@ -14,7 +14,7 @@ import smallSectionAsset from 'url:./imgs/info-content/small.svg';
|
||||
import simpleSectionAsset from 'url:./imgs/info-content/simple.svg';
|
||||
import secureSectionAsset from 'url:./imgs/info-content/secure.svg';
|
||||
import logoIcon from 'url:./imgs/demos/icon-demo-logo.png';
|
||||
import logoSVGSource from 'as-text:./logo-svg-include.txt';
|
||||
import logoSVGSourceImport from 'as-text:./logo-svg-include.txt';
|
||||
import * as style from './style.css';
|
||||
import type SnackBarElement from 'shared/custom-els/snack-bar';
|
||||
import 'shared/custom-els/snack-bar';
|
||||
@@ -69,6 +69,12 @@ async function getImageClipboardItem(
|
||||
}
|
||||
}
|
||||
|
||||
// The logo SVG source is pretty big, so to avoid it existing in both the HTML
|
||||
// and the JS bundle, we pick it up from the HTML.
|
||||
const logoSVGSource = __PRERENDER__
|
||||
? logoSVGSourceImport
|
||||
: document.querySelector('.' + style.logoContainer)!.innerHTML;
|
||||
|
||||
interface Props {
|
||||
onFile?: (file: File) => void;
|
||||
showSnack?: SnackBarElement['showSnackbar'];
|
||||
|
||||
Reference in New Issue
Block a user