Move fonts folder + Update setup docs for Vite
This commit is contained in:
parent
fa3cbbee67
commit
e73b6bc39e
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="icon" href="%sveltekit.assets%/assets/omorphia.png" />
|
||||
<link rel="icon" href="%sveltekit.assets%/omorphia.png" />
|
||||
|
||||
<link
|
||||
rel="preload"
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
<meta name="theme-color" content="#CF1971" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
<meta name="twitter:image" content="https://omorphia.modrinth.com/assets/omorphia.png" />
|
||||
<meta name="twitter:image" content="https://omorphia.modrinth.com/omorphia.png" />
|
||||
<meta property="og:site_name" content="Modrinth" />
|
||||
|
||||
%sveltekit.head%
|
||||
|
||||
@ -66,9 +66,7 @@ Add the following parts to your `svelte.config.js` file:
|
||||
|
||||
```js
|
||||
import adapter from '@sveltejs/adapter-auto'
|
||||
import { preprocess, plugins } from 'omorphia/config/svelte'
|
||||
import precompileIntl from 'svelte-intl-precompile/sveltekit-plugin'
|
||||
import { Generator } from 'omorphia/plugins'
|
||||
import { preprocess } from 'omorphia/config/svelte'
|
||||
import path from 'path'
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
@ -82,24 +80,6 @@ const config = {
|
||||
$generated: path.resolve('./generated'),
|
||||
$stores: path.resolve('./src/stores'),
|
||||
},
|
||||
|
||||
vite: {
|
||||
plugins: [
|
||||
...plugins,
|
||||
precompileIntl('locales'),
|
||||
Generator({
|
||||
gameVersions: true,
|
||||
openapi: true,
|
||||
// Add more if needed
|
||||
}),
|
||||
],
|
||||
|
||||
server: {
|
||||
fs: {
|
||||
allow: ['generated'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -114,7 +94,38 @@ import { writable } from 'svelte/store'
|
||||
export const token = writable('')
|
||||
```
|
||||
|
||||
## `5.` Configure PostCSS
|
||||
## `5.` Configure Vite
|
||||
|
||||
Add the following to your `vite.config.js` file:
|
||||
|
||||
```js
|
||||
import { plugins } from 'omorphia/config/vite.js'
|
||||
import { Generator } from 'omorphia/plugins'
|
||||
import precompileIntl from 'svelte-intl-precompile/sveltekit-plugin'
|
||||
|
||||
/** @type {import('vite').UserConfig} */
|
||||
const config = {
|
||||
plugins: [
|
||||
...plugins,
|
||||
precompileIntl('locales'),
|
||||
Generator({
|
||||
gameVersions: true,
|
||||
openapi: true,
|
||||
// Add more if needed
|
||||
}),
|
||||
],
|
||||
|
||||
server: {
|
||||
fs: {
|
||||
allow: ['generated'],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default config
|
||||
```
|
||||
|
||||
## `6.` Configure PostCSS
|
||||
|
||||
Create a `postcss.config.cjs` file in the root of your project.
|
||||
|
||||
@ -124,7 +135,7 @@ Add the following line to that file:
|
||||
module.exports = require('omorphia/config/postcss.cjs')
|
||||
```
|
||||
|
||||
## `6.` Setup styles
|
||||
## `7.` Setup styles
|
||||
|
||||
Import styles in `src/routes/__layout.svelte`:
|
||||
|
||||
@ -142,7 +153,7 @@ Add the `base` class and a theme to the `<body>` tag in `src/app.html`:
|
||||
</body>
|
||||
```
|
||||
|
||||
## `7.` Setup fonts
|
||||
## `8.` Setup fonts
|
||||
|
||||
Copy the the `fonts/` folder from [Omorphia's repository](https://github.com/modrinth/omorphia/blob/main/docs/static/assets/fonts) and place them in the `static/` folder at the root of your project.
|
||||
|
||||
@ -151,14 +162,14 @@ Add the following preload tags to your head in `app.html` to speed up font loadi
|
||||
<!-- prettier-ignore-start -->
|
||||
```html
|
||||
<head>
|
||||
<link rel="preload" href="/assets/fonts/InterRegular.woff2" as="font" type="font/woff2" crossorigin>
|
||||
<link rel="preload" href="/assets/fonts/InterBold.woff2" as="font" type="font/woff2" crossorigin>
|
||||
<link rel="preload" href="/assets/fonts/InterSemiBold.woff2" as="font" type="font/woff2" crossorigin>
|
||||
<link rel="preload" href="/fonts/InterRegular.woff2" as="font" type="font/woff2" crossorigin>
|
||||
<link rel="preload" href="/fonts/InterBold.woff2" as="font" type="font/woff2" crossorigin>
|
||||
<link rel="preload" href="/fonts/InterSemiBold.woff2" as="font" type="font/woff2" crossorigin>
|
||||
</head>
|
||||
```
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
## `8.` Using Omorphia
|
||||
## `9.` Using Omorphia
|
||||
|
||||
### Developing
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@ -25,7 +25,7 @@
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: fallback;
|
||||
src: local(''), url('/assets/fonts/InterRegular.woff2') format('woff2');
|
||||
src: local(''), url('/fonts/InterRegular.woff2') format('woff2');
|
||||
}
|
||||
|
||||
/* inter-600 - latin */
|
||||
@ -34,7 +34,7 @@
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
font-display: fallback;
|
||||
src: local(''), url('/assets/fonts/InterSemiBold.woff2') format('woff2');
|
||||
src: local(''), url('/fonts/InterSemiBold.woff2') format('woff2');
|
||||
}
|
||||
|
||||
/* inter-700 - latin */
|
||||
@ -43,6 +43,6 @@
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: fallback;
|
||||
src: local(''), url('/assets/fonts/InterBold.woff2') format('woff2');
|
||||
src: local(''), url('/fonts/InterBold.woff2') format('woff2');
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user