replace icons in embeds

This commit is contained in:
dakkar 2024-10-10 13:50:20 +01:00
parent 7628fe9c46
commit a2d47f686f
2 changed files with 7 additions and 8 deletions

View file

@ -630,9 +630,9 @@ seems to do a decent job)
* check the changes against our `develop` (`git diff develop`) and
against Misskey (`git diff misskey/develop`)
* re-generate `misskey-js` (`pnpm build-misskey-js-with-types`) and commit
* build the frontend: `rm -rf built/; NODE_ENV=development pnpm --filter=frontend
build` (the `development` tells it to keep some of the original
filenames in the built files)
* build the frontend: `rm -rf built/; NODE_ENV=development pnpm
--filter=frontend --filter=frontend-embed build` (the `development`
tells it to keep some of the original filenames in the built files)
* make sure there aren't any new `ti-*` classes (Tabler Icons), and
replace them with appropriate `ph-*` ones (Phosphor Icons):
`grep -rP '["'\'']ti[ -](?!fw)' -- built/` should show you what to change.

View file

@ -6,6 +6,7 @@ import locales from '../../locales/index.js';
import meta from '../../package.json';
import packageInfo from './package.json' with { type: 'json' };
import pluginJson5 from './vite.json5.js';
import { pluginReplaceIcons } from '../frontend/vite.replaceIcons.ts';
const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.json', '.json5', '.svg', '.sass', '.scss', '.css', '.vue'];
@ -68,6 +69,7 @@ export function getConfig(): UserConfig {
plugins: [
pluginVue(),
pluginJson5(),
...pluginReplaceIcons(),
],
resolve: {
@ -84,11 +86,8 @@ export function getConfig(): UserConfig {
modules: {
generateScopedName(name, filename, _css): string {
const id = (path.relative(__dirname, filename.split('?')[0]) + '-' + name).replace(/[\\\/\.\?&=]/g, '-').replace(/(src-|vue-)/g, '');
if (process.env.NODE_ENV === 'production') {
return 'x' + toBase62(hash(id)).substring(0, 4);
} else {
return id;
}
const shortId = id.replace(/^(components(-global)?|widgets|ui(-_common_)?)-/, '');
return shortId + '-' + toBase62(hash(id)).substring(0, 4);
},
},
},