mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-17 05:02:06 +00:00
fix: fix README
This commit is contained in:
22
readme.md
22
readme.md
@ -213,7 +213,7 @@ export default (win: Electron.BrowserWindow, config: ConfigType<'YOUR-PLUGIN-NAM
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
then, register the plugin in `index.ts`:
|
then, register the plugin in `src/index.ts`:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import yourPlugin from './plugins/YOUR-PLUGIN-NAME/back';
|
import yourPlugin from './plugins/YOUR-PLUGIN-NAME/back';
|
||||||
@ -236,7 +236,7 @@ export default (config: ConfigType<'YOUR-PLUGIN-NAME'>) => {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
then, register the plugin in `preload.ts`:
|
then, register the plugin in `src/renderer.ts`:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import yourPlugin from './plugins/YOUR-PLUGIN-NAME/front';
|
import yourPlugin from './plugins/YOUR-PLUGIN-NAME/front';
|
||||||
@ -247,17 +247,31 @@ const rendererPlugins: PluginMapper<'renderer'> = {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Finally, add the plugin to the default config file `src/config/default.ts`:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
export default {
|
||||||
|
// ...
|
||||||
|
'plugins': {
|
||||||
|
// ...
|
||||||
|
'YOUR-PLUGIN-NAME': {
|
||||||
|
// ...
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
### Common use cases
|
### Common use cases
|
||||||
|
|
||||||
- injecting custom CSS: create a `style.css` file in the same folder then:
|
- injecting custom CSS: create a `style.css` file in the same folder then:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { injectCSS } from '../utils';
|
import style from './style.css';
|
||||||
|
|
||||||
// back.ts
|
// back.ts
|
||||||
export default (win: Electron.BrowserWindow) => {
|
export default (win: Electron.BrowserWindow) => {
|
||||||
injectCSS(win.webContents, path.join(__dirname, 'style.css'));
|
injectCSS(win.webContents, style);
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user