5 |
6 |
7 | ## Joy of Code
8 |
9 | Web development and design-focused content.
10 |
11 | ## ▶️ YouTube 
12 |
13 | You can find my videos on [YouTube](https://www.youtube.com/@joyofcodedev).
14 |
15 | ## 🙏 Support
16 |
17 | You can support my work by [becoming a patron](https://www.patreon.com/joyofcode) starting low as **$1/month**.
18 |
19 | ## 🤗 Contributing
20 |
21 | At the end of each post there's a direct link to the **Markdown** file of the post you can edit within GitHub. Read the [contributing guidelines](CONTRIBUTING.md) to learn more.
22 |
23 | ## 🧭 Uses
24 |
25 | - ⚡️ [SvelteKit](https://kit.svelte.dev/) for the framework and prerendering pages ahead of time making it blazingly fast 🔥
26 |
27 | - The project is hosted on [Vercel](https://vercel.com/)
28 |
29 | - I use [Buttondown](https://buttondown.email/) for the newsletter when I remember to send one 🤭
30 |
31 | ## 📜 Setup
32 |
33 | These instructions are mostly if you want to learn how the code works but in general **I don't accept pull requests that aren't related to posts** but you can always raise an issue.
34 |
35 | The project uses 📦️ [pnpm](https://pnpm.io/) but any package manager should work.
36 |
37 | ### 👬 Clone the project
38 |
39 | ```sh
40 | git clone https://github.com/mattcroat/joy-of-code.git
41 | ```
42 |
43 | ### ⚙️ Rename `.env.example` to `.env`
44 |
45 | ```text
46 | # Private
47 | BUTTONDOWN_API_KEY=API_KEY
48 | ```
49 |
50 | ### 📦️ Install the dependencies
51 |
52 | ```sh
53 | pnpm i
54 | ```
55 |
56 | ### 💿️ Run the development server
57 |
58 | ```sh
59 | pnpm run dev
60 | ```
61 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "joy-of-code",
3 | "type": "module",
4 | "scripts": {
5 | "dev": "vite dev",
6 | "build": "vite build",
7 | "preview": "vite preview",
8 | "test": "playwright test",
9 | "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
10 | "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
11 | "test:unit": "vitest",
12 | "lint": "prettier --plugin-search-dir . --check . && eslint .",
13 | "format": "prettier --plugin-search-dir . --write ."
14 | },
15 | "devDependencies": {
16 | "@melt-ui/pp": "^0.3.0",
17 | "@playwright/test": "^1.41.2",
18 | "@shikijs/rehype": "^1.9.0",
19 | "@shikijs/transformers": "^1.9.0",
20 | "@sveltejs/adapter-vercel": "^5.1.0",
21 | "@sveltejs/kit": "^2.5.27",
22 | "@sveltejs/vite-plugin-svelte": "^4.0.0",
23 | "@types/node": "^20.11.17",
24 | "@typescript-eslint/eslint-plugin": "^6.21.0",
25 | "@typescript-eslint/parser": "^6.21.0",
26 | "eslint": "^8.56.0",
27 | "eslint-config-prettier": "^9.1.0",
28 | "eslint-plugin-svelte3": "^4.0.0",
29 | "prettier": "^3.2.5",
30 | "prettier-plugin-svelte": "^3.2.6",
31 | "sass": "^1.70.0",
32 | "svelte": "^5.0.0",
33 | "svelte-check": "^4.0.0",
34 | "svelte-preprocess": "^6.0.0",
35 | "tslib": "^2.6.2",
36 | "typescript": "^5.5.0",
37 | "vite": "^5.4.4"
38 | },
39 | "dependencies": {
40 | "@melt-ui/svelte": "^0.73.0",
41 | "flexsearch": "^0.7.43",
42 | "gray-matter": "^4.0.3",
43 | "lite-youtube-embed": "^0.3.0",
44 | "posthog-js": "^1.242.2",
45 | "rehype-autolink-headings": "^7.1.0",
46 | "rehype-code-titles": "^1.2.0",
47 | "rehype-slug": "^6.0.0",
48 | "rehype-stringify": "^10.0.0",
49 | "remark-gfm": "^4.0.0",
50 | "remark-parse": "^11.0.0",
51 | "remark-rehype": "^11.1.0",
52 | "remark-smartypants": "^2.1.0",
53 | "remark-toc": "^9.0.0",
54 | "unified": "^11.0.4",
55 | "unist-util-visit": "^5.0.0"
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/playwright.config.ts:
--------------------------------------------------------------------------------
1 | import type { PlaywrightTestConfig } from '@playwright/test'
2 |
3 | const config: PlaywrightTestConfig = {
4 | webServer: {
5 | command: 'pnpm run build && pnpm run preview',
6 | port: 3000,
7 | },
8 | }
9 |
10 | export default config
11 |
--------------------------------------------------------------------------------
/posts/animation-with-svelte/images/animate-flip.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/animation-with-svelte/images/animate-flip.mp4
--------------------------------------------------------------------------------
/posts/animation-with-svelte/images/crossfade.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/animation-with-svelte/images/crossfade.webp
--------------------------------------------------------------------------------
/posts/animation-with-svelte/images/flip-gsap.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/animation-with-svelte/images/flip-gsap.mp4
--------------------------------------------------------------------------------
/posts/animation-with-svelte/images/flip-svelte.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/animation-with-svelte/images/flip-svelte.mp4
--------------------------------------------------------------------------------
/posts/animation-with-svelte/images/flip.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/animation-with-svelte/images/flip.webp
--------------------------------------------------------------------------------
/posts/animation-with-svelte/images/motion-spring.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/animation-with-svelte/images/motion-spring.mp4
--------------------------------------------------------------------------------
/posts/animation-with-svelte/images/motion-tweened.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/animation-with-svelte/images/motion-tweened.mp4
--------------------------------------------------------------------------------
/posts/animation-with-svelte/images/transitions-custom-css.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/animation-with-svelte/images/transitions-custom-css.mp4
--------------------------------------------------------------------------------
/posts/animation-with-svelte/images/transitions-custom-js.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/animation-with-svelte/images/transitions-custom-js.mp4
--------------------------------------------------------------------------------
/posts/animation-with-svelte/images/transitions-deferred.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/animation-with-svelte/images/transitions-deferred.mp4
--------------------------------------------------------------------------------
/posts/animation-with-svelte/images/transitions-examples.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/animation-with-svelte/images/transitions-examples.mp4
--------------------------------------------------------------------------------
/posts/animation-with-svelte/images/transitions-fly.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/animation-with-svelte/images/transitions-fly.mp4
--------------------------------------------------------------------------------
/posts/animation-with-svelte/images/transitions-key.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/animation-with-svelte/images/transitions-key.mp4
--------------------------------------------------------------------------------
/posts/animation-with-svelte/images/transitions-local.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/animation-with-svelte/images/transitions-local.mp4
--------------------------------------------------------------------------------
/posts/animation-with-svelte/images/tweet.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/animation-with-svelte/images/tweet.webp
--------------------------------------------------------------------------------
/posts/avoid-flashing-iframe/images/iframe-flashing.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/avoid-flashing-iframe/images/iframe-flashing.mp4
--------------------------------------------------------------------------------
/posts/avoid-flashing-iframe/images/iframe-without-flashing.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/avoid-flashing-iframe/images/iframe-without-flashing.mp4
--------------------------------------------------------------------------------
/posts/clean-git-history/images/feature-behind-rebase.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/clean-git-history/images/feature-behind-rebase.png
--------------------------------------------------------------------------------
/posts/clean-git-history/images/feature-behind-upstream.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/clean-git-history/images/feature-behind-upstream.png
--------------------------------------------------------------------------------
/posts/clean-git-history/images/first-commits.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/clean-git-history/images/first-commits.png
--------------------------------------------------------------------------------
/posts/clean-git-history/images/first-merge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/clean-git-history/images/first-merge.png
--------------------------------------------------------------------------------
/posts/clean-git-history/images/rebase-checkout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/clean-git-history/images/rebase-checkout.png
--------------------------------------------------------------------------------
/posts/clean-git-history/images/rebase-commit-change.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/clean-git-history/images/rebase-commit-change.png
--------------------------------------------------------------------------------
/posts/clean-git-history/images/rebase-commit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/clean-git-history/images/rebase-commit.png
--------------------------------------------------------------------------------
/posts/clean-git-history/images/rebase-complete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/clean-git-history/images/rebase-complete.png
--------------------------------------------------------------------------------
/posts/clean-git-history/images/rebase-open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/clean-git-history/images/rebase-open.png
--------------------------------------------------------------------------------
/posts/clean-git-history/images/vs-code.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/clean-git-history/images/vs-code.png
--------------------------------------------------------------------------------
/posts/create-a-coding-sandbox/images/codepen.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/create-a-coding-sandbox/images/codepen.webp
--------------------------------------------------------------------------------
/posts/create-a-coding-sandbox/images/diagram.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/create-a-coding-sandbox/images/diagram.webp
--------------------------------------------------------------------------------
/posts/create-a-coding-sandbox/images/error.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/create-a-coding-sandbox/images/error.webp
--------------------------------------------------------------------------------
/posts/create-a-coding-sandbox/images/iframe.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/create-a-coding-sandbox/images/iframe.webp
--------------------------------------------------------------------------------
/posts/create-a-coding-sandbox/images/source.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/create-a-coding-sandbox/images/source.webp
--------------------------------------------------------------------------------
/posts/create-a-markdown-blog/images/layout.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/create-a-markdown-blog/images/layout.webp
--------------------------------------------------------------------------------
/posts/create-a-markdown-blog/images/mdx-component.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/create-a-markdown-blog/images/mdx-component.webp
--------------------------------------------------------------------------------
/posts/create-a-markdown-blog/images/next-page-render.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/create-a-markdown-blog/images/next-page-render.webp
--------------------------------------------------------------------------------
/posts/create-a-markdown-blog/images/site-diagram.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/create-a-markdown-blog/images/site-diagram.webp
--------------------------------------------------------------------------------
/posts/create-a-markdown-blog/images/sorted-posts.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/create-a-markdown-blog/images/sorted-posts.webp
--------------------------------------------------------------------------------
/posts/create-a-markdown-blog/images/vercel.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/create-a-markdown-blog/images/vercel.webp
--------------------------------------------------------------------------------
/posts/creating-content/images/audio-filters.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/creating-content/images/audio-filters.webp
--------------------------------------------------------------------------------
/posts/creating-content/images/editing.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/creating-content/images/editing.mp4
--------------------------------------------------------------------------------
/posts/creating-content/images/interface.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/creating-content/images/interface.webp
--------------------------------------------------------------------------------
/posts/creating-content/images/macro.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/creating-content/images/macro.mp4
--------------------------------------------------------------------------------
/posts/creating-content/images/microphone.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/creating-content/images/microphone.webp
--------------------------------------------------------------------------------
/posts/creating-content/images/obs-1.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/creating-content/images/obs-1.webp
--------------------------------------------------------------------------------
/posts/creating-content/images/obs-2.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/creating-content/images/obs-2.webp
--------------------------------------------------------------------------------
/posts/creating-content/images/obs-3.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/creating-content/images/obs-3.webp
--------------------------------------------------------------------------------
/posts/creating-content/images/obs-4.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/creating-content/images/obs-4.webp
--------------------------------------------------------------------------------
/posts/creating-content/images/shure.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/creating-content/images/shure.webp
--------------------------------------------------------------------------------
/posts/creating-content/images/video.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/creating-content/images/video.mp4
--------------------------------------------------------------------------------
/posts/css-focus-outline/images/border.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/css-focus-outline/images/border.gif
--------------------------------------------------------------------------------
/posts/css-focus-outline/images/box-shadow.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/css-focus-outline/images/box-shadow.gif
--------------------------------------------------------------------------------
/posts/css-focus-outline/images/default.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/css-focus-outline/images/default.gif
--------------------------------------------------------------------------------
/posts/css-focus-outline/images/no-outline.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/css-focus-outline/images/no-outline.gif
--------------------------------------------------------------------------------
/posts/css-focus-outline/images/outline.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/css-focus-outline/images/outline.gif
--------------------------------------------------------------------------------
/posts/dark-mode-favicon/images/comparison.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/dark-mode-favicon/images/comparison.webp
--------------------------------------------------------------------------------
/posts/dark-mode-favicon/images/link-media.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/dark-mode-favicon/images/link-media.webp
--------------------------------------------------------------------------------
/posts/dark-mode-favicon/images/prefers-color-scheme.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/dark-mode-favicon/images/prefers-color-scheme.webp
--------------------------------------------------------------------------------
/posts/dark-mode-favicon/images/safari.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/dark-mode-favicon/images/safari.webp
--------------------------------------------------------------------------------
/posts/dark-mode-favicon/images/svg-favicons.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/dark-mode-favicon/images/svg-favicons.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/alignment-bad.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/alignment-bad.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/alignment-good.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/alignment-good.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/alignment-grid.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/alignment-grid.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/alignment-spacing.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/alignment-spacing.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/apple-grid.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/apple-grid.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/color-contrast-bad.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/color-contrast-bad.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/color-contrast-good.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/color-contrast-good.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/color-palette.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/color-palette.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/color-picker.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/color-picker.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/color-rule.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/color-rule.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/color-wheel.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/color-wheel.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/contrast-checker.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/contrast-checker.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/proximity-outline.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/proximity-outline.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/proximity.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/proximity.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/repetition-scrolling-area.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/repetition-scrolling-area.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/repetition-scrolling-heading.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/repetition-scrolling-heading.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/repetition.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/repetition.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/scroll-more-idiot.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/scroll-more-idiot.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/text-contrast.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/text-contrast.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/typefaces.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/typefaces.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/typography.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/typography.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/wireframe-landing-page.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/wireframe-landing-page.webp
--------------------------------------------------------------------------------
/posts/design-for-developers/images/wireframe.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/design-for-developers/images/wireframe.webp
--------------------------------------------------------------------------------
/posts/dynamic-social-share-images/images/social-card.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/dynamic-social-share-images/images/social-card.webp
--------------------------------------------------------------------------------
/posts/dynamic-social-share-images/images/social-share-image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/dynamic-social-share-images/images/social-share-image.png
--------------------------------------------------------------------------------
/posts/dynamic-social-share-images/images/social-share.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/dynamic-social-share-images/images/social-share.webp
--------------------------------------------------------------------------------
/posts/global-styles-in-sveltekit/global-styles-in-sveltekit.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: How To Use Global Styles In SvelteKit
3 | description: How to use global styles in SvelteKit.
4 | slug: global-styles-in-sveltekit
5 | published: '2022-11-24'
6 | category: sveltekit
7 | ---
8 |
9 | {% youtube id="jHSwChkx3TQ" title="Global Styles In SvelteKit" %}
10 |
11 | ## Table of Contents
12 |
13 | ## app.html
14 |
15 | You can include your global styles inside `app.html` in SvelteKit but then you can't take advantage of [HMR (hot module replacement)](https://vitejs.dev/guide/features.html#hot-module-replacement) since SvelteKit has no idea the file got updated.
16 |
17 | ```svelte:src/app.html showLineNumbers
18 |
19 |
20 |
25 |
26 |
27 | ```
28 |
29 | ## +layout.svelte
30 |
31 | Instead use a `+layout.svelte` file and import your styles.
32 |
33 | ```css:src/app.css showLineNumbers
34 | h1 {
35 | color: aqua;
36 | }
37 | ```
38 |
39 | ```svelte:routes/+layout.svelte showLineNumbers
40 |
43 |
44 |
45 | ```
46 |
47 | The base layout wraps the entire SvelteKit app.
48 |
49 | ## :global
50 |
51 | Svelte ignores styles that aren't part of your template which sucks when you don't have control over the markup from a CMS (content management system), or the markup is inside another component.
52 |
53 | In that case you can use `:global`.
54 |
55 | ```svelte:+page.svelte showLineNumbers
56 |
59 |
60 |
61 | {@html data.content}
62 |
63 |
64 |
69 | ```
70 |
71 | You can scope `.prose` to the component if you want.
72 |
73 | ```svelte:+page.svelte showLineNumbers
74 |
75 |
76 |
81 | ```
82 |
83 | SvelteKit by default comes with the [svelte-preprocess](https://github.com/sveltejs/svelte-preprocess) preprocessor where you can use the `global` attribute on the `
93 | ```
94 |
--------------------------------------------------------------------------------
/posts/great-developers-steal/images/search-results.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/great-developers-steal/images/search-results.webp
--------------------------------------------------------------------------------
/posts/great-developers-steal/images/spec.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/great-developers-steal/images/spec.webp
--------------------------------------------------------------------------------
/posts/how-to-optimize-images/images/squoosh.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/how-to-optimize-images/images/squoosh.webp
--------------------------------------------------------------------------------
/posts/impossible-layout-animations-with-svelte/images/circle-flip.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/impossible-layout-animations-with-svelte/images/circle-flip.mp4
--------------------------------------------------------------------------------
/posts/impossible-layout-animations-with-svelte/images/circle-teleport.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/impossible-layout-animations-with-svelte/images/circle-teleport.mp4
--------------------------------------------------------------------------------
/posts/impossible-layout-animations-with-svelte/images/flip-circles.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/impossible-layout-animations-with-svelte/images/flip-circles.mp4
--------------------------------------------------------------------------------
/posts/impossible-layout-animations-with-svelte/images/flip-grid.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/impossible-layout-animations-with-svelte/images/flip-grid.mp4
--------------------------------------------------------------------------------
/posts/impossible-layout-animations-with-svelte/images/flip-movies.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/impossible-layout-animations-with-svelte/images/flip-movies.mp4
--------------------------------------------------------------------------------
/posts/impossible-layout-animations-with-svelte/images/flip.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/impossible-layout-animations-with-svelte/images/flip.webp
--------------------------------------------------------------------------------
/posts/impossible-layout-animations-with-svelte/images/how-flip-works.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/impossible-layout-animations-with-svelte/images/how-flip-works.mp4
--------------------------------------------------------------------------------
/posts/intro-to-react/images/js-update.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/intro-to-react/images/js-update.gif
--------------------------------------------------------------------------------
/posts/intro-to-react/images/paint-flashing.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/intro-to-react/images/paint-flashing.webp
--------------------------------------------------------------------------------
/posts/intro-to-react/images/react-update.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/intro-to-react/images/react-update.gif
--------------------------------------------------------------------------------
/posts/introduction-to-3d-with-svelte/images/controls.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/introduction-to-3d-with-svelte/images/controls.webp
--------------------------------------------------------------------------------
/posts/introduction-to-3d-with-svelte/images/models.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/introduction-to-3d-with-svelte/images/models.mp4
--------------------------------------------------------------------------------
/posts/introduction-to-3d-with-svelte/images/scene.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/introduction-to-3d-with-svelte/images/scene.webp
--------------------------------------------------------------------------------
/posts/introduction-to-3d-with-svelte/images/sphere.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/introduction-to-3d-with-svelte/images/sphere.webp
--------------------------------------------------------------------------------
/posts/introduction-to-3d-with-svelte/images/spooky.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/introduction-to-3d-with-svelte/images/spooky.webp
--------------------------------------------------------------------------------
/posts/introduction-to-tailwind-css/images/banding.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/introduction-to-tailwind-css/images/banding.webp
--------------------------------------------------------------------------------
/posts/learn-how-sveltekit-works/images/csr.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/learn-how-sveltekit-works/images/csr.webp
--------------------------------------------------------------------------------
/posts/learn-how-sveltekit-works/images/debugger.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/learn-how-sveltekit-works/images/debugger.webp
--------------------------------------------------------------------------------
/posts/learn-how-sveltekit-works/images/hydration.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/learn-how-sveltekit-works/images/hydration.webp
--------------------------------------------------------------------------------
/posts/learn-how-sveltekit-works/images/kit.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/learn-how-sveltekit-works/images/kit.webp
--------------------------------------------------------------------------------
/posts/learn-how-sveltekit-works/images/navigation.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/learn-how-sveltekit-works/images/navigation.webp
--------------------------------------------------------------------------------
/posts/learn-how-sveltekit-works/images/ssr.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/learn-how-sveltekit-works/images/ssr.webp
--------------------------------------------------------------------------------
/posts/learn-how-sveltekit-works/images/sveltekit.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/learn-how-sveltekit-works/images/sveltekit.webp
--------------------------------------------------------------------------------
/posts/learn-how-sveltekit-works/images/twitter.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/learn-how-sveltekit-works/images/twitter.webp
--------------------------------------------------------------------------------
/posts/learn-problem-solving/images/player.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/learn-problem-solving/images/player.webp
--------------------------------------------------------------------------------
/posts/learn-problem-solving/images/todos.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/learn-problem-solving/images/todos.webp
--------------------------------------------------------------------------------
/posts/master-the-svelte-context-api/images/context-api.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/master-the-svelte-context-api/images/context-api.webp
--------------------------------------------------------------------------------
/posts/next-bundle-size/images/preact.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/next-bundle-size/images/preact.webp
--------------------------------------------------------------------------------
/posts/next-bundle-size/images/react.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/next-bundle-size/images/react.webp
--------------------------------------------------------------------------------
/posts/next-bundle-size/next-bundle-size.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Reduce Next.js Bundle Size by Half
3 | description: Learn how using Preact instead of React can reduce Next.js bundle size by half.
4 | slug: next-bundle-size
5 | published: '2021-9-1'
6 | category: next
7 | ---
8 |
9 | [Next.js](https://nextjs.org/) is a **meta-framework** built on top of [React](https://reactjs.org/) that solves the problem of **hybrid static and server rendering** for **React**.
10 |
11 | That being said the [react](https://bundlephobia.com/package/react@17.0.2) package itself is a tiny library, but combined with [react-dom](https://bundlephobia.com/package/react-dom@17.0.2) it's **42 kB** of **runtime** we ship to the client.
12 |
13 | {% img src="react.webp" alt="Next.js bundle size using React" %}
14 |
15 | The final **Next.js** bundle size is **79.46 kB**.
16 |
17 | [Preact](https://preactjs.com/) is a **React** alternative with the same API, but it's only [3kb in size](https://bundlephobia.com/package/preact@10.5.14). This is possible because it doesn't have extra overhead from using [synthetic events](https://reactjs.org/docs/events.html) like **React**, but uses the **browser's native API**.
18 |
19 | If you want to be more informed about the differences, **Preact** has an entire page dedicated explaining the [differences to React](https://preactjs.com/guide/v8/differences-to-react/) (you could say it's _svelte_ 🥁).
20 |
21 | This might sound like a lot of work, but it only requires two steps changing the **Webpack** config inside **Next.js**. Credits go to [Lee Robinson](https://leerob.io/).
22 |
23 | The first step is to install **Preact**.
24 |
25 | ```shell:terminal
26 | npm i preact
27 | ```
28 |
29 | The second step is replacing **React** with **Preact** in production by changing the `next.config.js`.
30 |
31 | ```js:next.config.js showLineNumbers
32 | module.exports = {
33 | webpack: (config, { dev, isServer }) => {
34 | if (!dev && !isServer) {
35 | Object.assign(config.resolve.alias, {
36 | react: 'preact/compat',
37 | 'react-dom/test-utils': 'preact/test-utils',
38 | 'react-dom': 'preact/compat',
39 | })
40 | }
41 | return config
42 | },
43 | }
44 | ```
45 |
46 | That's it! 🥳 Next time you run `npm run build`, and `npm start` there's a **48%** reduction in bundle size at **45.28 Kb**.
47 |
48 | {% img src="preact.webp" alt="Next.js bundle size using Preact" %}
49 |
50 | ## Conclusion
51 |
52 | This is a great method to save your users from having to download the entire **React** runtime, but make sure you're informed about the differences between **React** and **Preact** if you need some specific **React** features.
53 |
54 | Thanks for reading! 🏄♀️
55 |
--------------------------------------------------------------------------------
/posts/responsive-css-grid-layout/responsive-css-grid-layout.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Use This Simple Line Of CSS Grid To Make Your Layout Responsive
3 | description: Avoid writing a bunch of media queries using a single line of CSS Grid.
4 | slug: responsive-css-grid-layout
5 | published: '2024-03-28'
6 | category: css
7 | ---
8 |
9 | {% embed src="https://svelte.dev/repl/2a2644dd768c43f6a5e16ef94fd145ca?version=4.2.12" title="Responsive CSS Grid Layout" %}
10 |
11 | If you're using [CSS Grid](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_grid_layout) for your layout, you can avoid writing a bunch of media queries with this simple line of CSS.
12 |
13 | ```css:css {3} showLineNumbers
14 | .grid {
15 | display: grid;
16 | grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
17 | }
18 | ```
19 |
20 | Let's break it down:
21 |
22 | - `repeat` uses `auto-fill` as the repeat count to repeat the grid item as many times as needed
23 | - `minmax` specifies a minimum size of `200px`, and maximum size of `1fr` for the grid item
24 |
25 | You could also use `auto-fit` instead of `auto-fill`, but what is the difference?
26 |
27 | {% embed src="https://svelte.dev/repl/6b20131ea56a480b83af648d461bc1b4?version=4.2.12" title="CSS Grid Auto-Fill Versus Auto-Fit" %}
28 |
29 | If you want to stretch the grid items to take the entire available space use `auto-fit`, otherwise use `auto-fill`.
30 |
--------------------------------------------------------------------------------
/posts/rethink-how-you-write-git-commits/images/commit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/rethink-how-you-write-git-commits/images/commit.png
--------------------------------------------------------------------------------
/posts/rethink-how-you-write-git-commits/images/confused.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/rethink-how-you-write-git-commits/images/confused.webp
--------------------------------------------------------------------------------
/posts/rethink-how-you-write-git-commits/images/git.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/rethink-how-you-write-git-commits/images/git.png
--------------------------------------------------------------------------------
/posts/rethink-how-you-write-git-commits/images/gitmoji.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/rethink-how-you-write-git-commits/images/gitmoji.png
--------------------------------------------------------------------------------
/posts/rethink-how-you-write-git-commits/images/options.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/rethink-how-you-write-git-commits/images/options.png
--------------------------------------------------------------------------------
/posts/screenshot-page-and-dom-elements/images/brave-screenshot.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/screenshot-page-and-dom-elements/images/brave-screenshot.webp
--------------------------------------------------------------------------------
/posts/screenshot-page-and-dom-elements/images/firefox-screenshot.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/screenshot-page-and-dom-elements/images/firefox-screenshot.webp
--------------------------------------------------------------------------------
/posts/screenshot-page-and-dom-elements/screenshot-page-and-dom-elements.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: How To Screenshot The Entire Page
3 | description: You don't need extensions to screenshot the page, sections and elements.
4 | slug: screenshot-page-and-dom-elements
5 | published: '2021-10-4'
6 | category: general
7 | ---
8 |
9 | ## Firefox
10 |
11 | One of the [Firefox](https://www.mozilla.org/en-US/firefox/new/) features I love is the [Take a Screenshot](https://support.mozilla.org/en-US/kb/take-screenshots-firefox) tool that let's you capture **visible parts** of the page, the **full page**, or **DOM** (Document Object Model) elements.
12 |
13 | You can do so using the **dropdown option**, or the Ctrl + Shift + S **shortcut**.
14 |
15 | {% img src="firefox-screenshot.webp" alt="Taking screenshot of elements in Firefox" %}
16 |
17 | ## Chrome
18 |
19 | This is the one thing I miss when using [Brave](https://brave.com/) but there's a solution that works for any [Chromium]() based browser.
20 |
21 | Open your developer tools with Ctrl + Shift + I, or use the **options menu** from your browser.
22 |
23 | Inspired by the [Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) from [Visual Studio Code](https://code.visualstudio.com/) you can open the [Command Menu](https://developer.chrome.com/docs/devtools/command-menu/) with Ctrl + Shift + P and typing **screenshot** you get these options.
24 |
25 | {% img src="brave-screenshot.webp" alt="Taking screenshot of elements in Brave" %}
26 |
27 | If you want to capture a **DOM** element it has to be **selected** in **elements**.
28 |
29 | ## Conclusion
30 |
31 | While it's not as convenient as **Firefox** at least you don't require an extension but if you're looking for one that lets you also record video you can use something like [Nimbus](https://chrome.google.com/webstore/detail/nimbus-screenshot-screen/bpconcjcammlapcogcnnelfmaeghhagj?hl=en).
32 |
33 | Thanks for reading! 🏄♀️
34 |
--------------------------------------------------------------------------------
/posts/simple-css-debug-trick/images/bookmarklet.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/simple-css-debug-trick/images/bookmarklet.webp
--------------------------------------------------------------------------------
/posts/simple-css-debug-trick/images/css-debug.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mattcroat/joy-of-code/6f7d47f5e73313b12747aa17c22aaaa07c62c598/posts/simple-css-debug-trick/images/css-debug.webp
--------------------------------------------------------------------------------
/posts/simple-css-debug-trick/simple-css-debug-trick.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Simple Trick To Debug Your CSS
3 | description: Learn how to debug CSS using this simple trick.
4 | slug: simple-css-debug-trick
5 | published: '2021-10-2'
6 | category: css
7 | ---
8 |
9 | {% youtube id="5nrMpCWkncc" title="Debug Your CSS" %}
10 |
11 | ## Table of Contents
12 |
13 | ## The Outline Trick
14 |
15 | The fastest way to find misbehaving elements on the page is using the `outline` trick in CSS. This helps you find issues such as overflowing elements quickly, but more importantly it gives you a visual of the entire page.
16 |
17 | {% img src="css-debug.webp" alt="Debugging CSS" %}
18 |
19 | You can use `outline` to set an outline on every element, which isn't going to affect the layout compared to using `border` — unless you specify `box-sizing: border-box`.
20 |
21 | ```css:css showLineNumbers
22 | * {
23 | outline: 1px solid tomato;
24 | }
25 | ```
26 |
27 | You can also add a `background` property, or use different `outline` colors for nested elements, if you want to make things more readable:
28 |
29 | ```css:css showLineNumbers
30 | * {
31 | outline: 1px solid tomato;
32 | }
33 |
34 | * * {
35 | outline: 1px solid black;
36 | }
37 |
38 | * * * {
39 | outline: 1px solid white;
40 | }
41 | ```
42 |
43 | ## Creating A Bookmarklet
44 |
45 | You can turn this helper into a JavaScript bookmarklet, and use it when you need it. The only thing you have to do is create a regular bookmark in your browser, and include this code.
46 |
47 | {% img src="bookmarklet.webp" alt="Bookmarklet" %}
48 |
49 | ```js:bookmarklet showLineNumbers
50 | javascript: (function () {
51 | const headElement = document.head;
52 | const styleElement = document.createElement('style');
53 | styleElement.setAttribute('debug-css', '');
54 | styleElement.innerText = '* { outline: 1px solid tomato; }';
55 |
56 | const debugElement = headElement.querySelector('[debug-css]');
57 | if (debugElement) return debugElement.remove();
58 |
59 | headElement.append(styleElement);
60 | })();
61 | ```
62 |
63 | The code uses an [IIFE](https://developer.mozilla.org/en-US/docs/Glossary/IIFE) to create a `
104 |
--------------------------------------------------------------------------------
/src/lib/ui/header/header.svelte:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
16 |
44 | Every post is a Markdown file so contributing is simple as following the
45 | link below and pressing the pencil icon inside GitHub to edit it.
46 |
14 | I'm Matija from 🇭🇷 Croatia and I'm infinitely curious at how
15 | things work but I'm mostly passionate about ☕
16 | JavaScript and
17 | 🎨
18 | UI/UX design.
19 |
20 |
21 | I created Joy of Code because I think a lot of tutorials don't help you
22 | learn how to solve problems but just read the documentation to you and go from
23 | point A to point B.
24 |
25 |
26 | I want to show you steps between A and B by sharing what I learn
27 | and how I think about solving problems.
28 |
29 |
30 | I'm trying to create something I wish existed — it's more like having a
31 | friend help you out instead of someone talking over your head.
32 |