Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhabib committed Dec 13, 2024
1 parent 719c957 commit 4622a3c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/makeWebpackConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ module.exports = async (playroomConfig, options) => {
chunksSortMode: 'none',
chunks: ['preview'],
filename: 'preview/index.html',
favicon: path.join(__dirname, '../images/favicon.png'),
publicPath: '../',
}),
new VanillaExtractPlugin({
Expand Down
11 changes: 11 additions & 0 deletions src/preview.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
import { renderElement } from './render';
import Preview from './Playroom/Preview';
import faviconPath from '../images/favicon.png';
import faviconInvertedPath from '../images/favicon-inverted.png';

const outlet = document.createElement('div');
document.body.appendChild(outlet);

const selectedElement = document.head.querySelector('link[rel="icon"]');
const favicon = window.matchMedia('(prefers-color-scheme: dark)').matches
? faviconInvertedPath
: faviconPath;

if (selectedElement) {
selectedElement.setAttribute('href', favicon);
}

const renderPreview = ({
themes = require('./themes'),
components = require('./components'),
Expand Down

0 comments on commit 4622a3c

Please sign in to comment.