Created
September 15, 2023 15:46
-
-
Save npdtdev/8f1ea653c5444c6b65a725e8401e09e8 to your computer and use it in GitHub Desktop.
Code for the blog post 'Self-hosting a font and using it with Sveltekit and Tailwindcss'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script lang="ts"> | |
| import '../app.css'; | |
| import '@fontsource-variable/oxanium'; | |
| </script> | |
| <slot /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h1>Look at the cool font I am using as default 🔥🔥🔥 </h1> | |
| <p class="font-chillax">I am using yet another font</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @import url('/fonts/chillax.css'); | |
| @tailwind base; | |
| @tailwind components; | |
| @tailwind utilities; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @font-face { | |
| font-family: 'Chillax'; | |
| src: url('/fonts/Chillax-Extralight.woff2') format('woff2'), | |
| url('/fonts/Chillax-Extralight.woff') format('woff'); | |
| font-weight: 200; | |
| font-display: swap; | |
| font-style: normal; | |
| } | |
| @font-face { | |
| font-family: 'Chillax'; | |
| src: url('/fonts/Chillax-Light.woff2') format('woff2'), | |
| url('/fonts/Chillax-Light.woff') format('woff'); | |
| font-weight: 300; | |
| font-display: swap; | |
| font-style: normal; | |
| } | |
| @font-face { | |
| font-family: 'Chillax'; | |
| src: url('/fonts/Chillax-Regular.woff2') format('woff2'), | |
| url('/fonts/Chillax-Regular.woff') format('woff'); | |
| font-weight: 400; | |
| font-display: swap; | |
| font-style: normal; | |
| } | |
| @font-face { | |
| font-family: 'Chillax'; | |
| src: url('/fonts/Chillax-Medium.woff2') format('woff2'), | |
| url('/fonts/Chillax-Medium.woff') format('woff'); | |
| font-weight: 500; | |
| font-display: swap; | |
| font-style: normal; | |
| } | |
| @font-face { | |
| font-family: 'Chillax'; | |
| src: url('/fonts/Chillax-Semibold.woff2') format('woff2'), | |
| url('/fonts/Chillax-Semibold.woff') format('woff'); | |
| font-weight: 600; | |
| font-display: swap; | |
| font-style: normal; | |
| } | |
| @font-face { | |
| font-family: 'Chillax'; | |
| src: url('/fonts/Chillax-Bold.woff2') format('woff2'), | |
| url('/fonts/Chillax-Bold.woff') format('woff'); | |
| font-weight: 700; | |
| font-display: swap; | |
| font-style: normal; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const defaultTheme = require('tailwindcss/defaultTheme'); | |
| /** @type {import('tailwindcss').Config} */ | |
| export default { | |
| content: ['./src/**/*.{html,js,svelte,ts}'], | |
| theme: { | |
| extend: { | |
| fontFamily: { | |
| sans: ['Oxanium Variable', ...defaultTheme.fontFamily.sans], | |
| chillax: ['Chillax'] | |
| } | |
| } | |
| }, | |
| plugins: [] | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment