111 |
112 | )
113 | }
114 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Next.js Blog Tutorial: Build SEO Optimized Personal Blog with Next.js, Contentlayer, and Tailwind CSS 🔥
2 |
3 | 
4 | 
5 | 
6 |
7 | This repository contains **starter code** for Personal Blog website created using NextJs.
8 |
9 | For Demo and Final Code checkout following links👇:
10 | [Nextjs Personal Blog Website Demo](https://create-blog-with-nextjs.vercel.app/)
11 |
12 | Final Code👇:
13 | ➡ Tutorial Code that uses Contentlayer: [Nextjs Personal Blog Website Final Code (contentlayer)](https://github.com/codebucks27/Nextjs-tailwindcss-blog-template/tree/Contentlayer)
14 | ➡ Latest Code with Velite.js instead of Contentlayer: [Nextjs Personal Blog Website Final Code (velite.js)](https://github.com/codebucks27/Nextjs-tailwindcss-blog-template) (Since contentlayer is not actively maintained, I've updated the code to use Velite.js instead.)
15 |
16 | If you want to learn how to create it please follow below tutorial👇:
17 | https://youtu.be/1QGLHOaRLwM
18 | [](https://youtu.be/1QGLHOaRLwM)
19 |
20 | ### ⭐DO NOT FORGET TO STAR THIS REPO⭐
21 |
22 | ### Images of The Portfolio Website:
23 |
24 | #### Home
25 | 
26 |
27 | #### About
28 | 
29 |
30 | #### Contact
31 | 
32 |
33 | For more Images please check the [project images](https://github.com/codebucks27/Nextjs-contentlayer-blog/tree/main/project%20images) folder from this repo or check the demo link.
34 |
35 |
36 | ### Resources Used in This Project
37 |
38 | - Character image in the About page created by using [Bing Search[(https://www.bing.com/).
39 | - Lottie animation in the contact page: [from here](https://lottiefiles.com/animations/sloth-meditate-SzNofNFhYY)
40 | - Fonts from https://fonts.google.com/
41 | - Icons from https://iconify.design/
42 |
43 | ### All the images used in the blogs:
44 | - Photo by Carlos Muza on Unsplash
45 | - Photo by Marvin Meyer on Unsplash
46 | - Photo by Paul Esch-Laurent on Unsplash
47 | - Photo by Kelly Sikkema on Unsplash
48 | - Photo by Lauren Mancke on Unsplash
49 | - Photo by Luca Bravo on Unsplash
50 | - Photo by Christina @ wocintechchat.com on Unsplash
51 | - Photo by C D-X on Unsplash
52 | - Photo by charlesdeluvio on Unsplash
53 | - Photo by Emile Perron on Unsplash
54 | - Photo by Roman Synkevych on Unsplash
55 |
56 |
57 | This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
58 |
59 | ## Getting Started
60 |
61 | First, run the development server:
62 |
63 | ```bash
64 | npm run dev
65 | # or
66 | yarn dev
67 | # or
68 | pnpm dev
69 | ```
70 |
71 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
72 |
73 | You can start editing the page by modifying `app/page.js`. The page auto-updates as you edit the file.
74 |
75 | This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
76 |
77 | ## Learn More
78 |
79 | To learn more about Next.js, take a look at the following resources:
80 |
81 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
82 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
83 |
84 | You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
85 |
86 | ## Deploy on Vercel
87 |
88 | The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
89 |
90 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
91 |
--------------------------------------------------------------------------------
/project files/blogs/best-practices-for-writing-clean-and-maintainable-code/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Best Practices for Writing Clean and Maintainable Code"
3 | description: How to deploy your Next.js apps on Vercel.
4 | image: "../../public/blogs/roman-synkevych-vXInUOv1n84-unsplash.jpg"
5 | publishedAt: "2023-01-02"
6 | updatedAt: "2023-01-02"
7 | author: "codebucks"
8 | isPublished: true
9 | tags:
10 | - code quality
11 | ---
12 |
13 |
14 |
15 | Until now, trying to style an article, document, or blog post with Tailwind has been a tedious task that required a keen eye for typography and a lot of complex custom CSS.
16 |
17 | By default, Tailwind removes all of the default browser styling from paragraphs, headings, lists and more. This ends up being really useful for building application UIs because you spend less time undoing user-agent styles, but when you _really are_ just trying to style some content that came from a rich-text editor in a CMS or a markdown file, it can be surprising and unintuitive.
18 |
19 | We get lots of complaints about it actually, with people regularly asking us things like:
20 |
21 | > Why is Tailwind removing the default styles on my `h1` elements? How do I disable this? What do you mean I lose all the other base styles too?
22 | > We hear you, but we're not convinced that simply disabling our base styles is what you really want. You don't want to have to remove annoying margins every time you use a `p` element in a piece of your dashboard UI. And I doubt you really want your blog posts to use the user-agent styles either — you want them to look _awesome_, not awful.
23 |
24 | The `@tailwindcss/typography` plugin is our attempt to give you what you _actually_ want, without any of the downsides of doing something stupid like disabling our base styles.
25 |
26 | It add a new `prose` class that you can slap on any block of vanilla HTML content and turn it into a beautiful, well-formatted document:
27 |
28 | ```html
29 |
30 |
Garlic bread with cheese: What the science tells us
31 |
32 | For years parents have espoused the health benefits of eating garlic bread
33 | with cheese to their children, with the food earning such an iconic status
34 | in our culture that kids will often dress up as warm, cheesy loaf for
35 | Halloween.
36 |
37 |
38 | But a recent study shows that the celebrated appetizer may be linked to a
39 | series of rabies cases springing up around the country.
40 |
41 |
42 | ```
43 |
44 | For more information about how to use the plugin and the features it includes, [read the documentation](https://github.com/tailwindcss/typography/blob/master/README.md).
45 |
46 | ---
47 |
48 | ## What to expect from here on out
49 |
50 | What follows from here is just a bunch of absolute nonsense I've written to dogfood the plugin itself. It includes every sensible typographic element I could think of, like **bold text**, unordered lists, ordered lists, code blocks, block quotes, _and even italics_.
51 |
52 | It's important to cover all of these use cases for a few reasons:
53 |
54 | 1. We want everything to look good out of the box.
55 | 2. Really just the first reason, that's the whole point of the plugin.
56 | 3. Here's a third pretend reason though a list with three items looks more realistic than a list with two items.
57 |
58 | Now we're going to try out another header style.
59 |
60 | ### Typography should be easy
61 |
62 | So that's a header for you — with any luck if we've done our job correctly that will look pretty reasonable.
63 |
64 | Something a wise person once told me about typography is:
65 |
66 | > Typography is pretty important if you don't want your stuff to look like trash. Make it good then it won't be bad.
67 |
68 | It's probably important that images look okay here by default as well:
69 |
70 |
77 |
78 | Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.
79 |
80 | Now I'm going to show you an example of an unordered list to make sure that looks good, too:
81 |
82 | - So here is the first item in this list.
83 | - In this example we're keeping the items short.
84 | - Later, we'll use longer, more complex list items.
85 |
86 | And that's the end of this section.
87 |
88 | ## What if we stack headings?
89 |
90 | ### We should make sure that looks good, too.
91 |
92 | Sometimes you have headings directly underneath each other. In those cases you often have to undo the top margin on the second heading because it usually looks better for the headings to be closer together than a paragraph followed by a heading should be.
93 |
94 | ### When a heading comes after a paragraph …
95 |
96 | When a heading comes after a paragraph, we need a bit more space, like I already mentioned above. Now let's see what a more complex list would look like.
97 |
98 | - **I often do this thing where list items have headings.**
99 |
100 | For some reason I think this looks cool which is unfortunate because it's pretty annoying to get the styles right.
101 |
102 | I often have two or three paragraphs in these list items, too, so the hard part is getting the spacing between the paragraphs, list item heading, and separate list items to all make sense. Pretty tough honestly, you could make a strong argument that you just shouldn't write this way.
103 |
104 | - **Since this is a list, I need at least two items.**
105 |
106 | I explained what I'm doing already in the previous list item, but a list wouldn't be a list if it only had one item, and we really want this to look realistic. That's why I've added this second list item so I actually have something to look at when writing the styles.
107 |
108 | - **It's not a bad idea to add a third item either.**
109 |
110 | I think it probably would've been fine to just use two items but three is definitely not worse, and since I seem to be having no trouble making up arbitrary things to type, I might as well include it.
111 |
112 | After this sort of list I usually have a closing statement or paragraph, because it kinda looks weird jumping right to a heading.
113 |
114 | ## Code should look okay by default.
115 |
116 | I think most people are going to use [highlight.js](https://highlightjs.org/) or [Prism](https://prismjs.com/) or something if they want to style their code blocks but it wouldn't hurt to make them look _okay_ out of the box, even with no syntax highlighting.
117 |
118 | Here's what a default `tailwind.config.js` file looks like at the time of writing:
119 |
120 | ```js
121 | module.exports = {
122 | purge: [],
123 | theme: {
124 | extend: {},
125 | },
126 | variants: {},
127 | plugins: [],
128 | }
129 | ```
130 |
131 | Hopefully that looks good enough to you.
132 |
133 | ### What about nested lists?
134 |
135 | Nested lists basically always look bad which is why editors like Medium don't even let you do it, but I guess since some of you goofballs are going to do it we have to carry the burden of at least making it work.
136 |
137 | 1. **Nested lists are rarely a good idea.**
138 | - You might feel like you are being really "organized" or something but you are just creating a gross shape on the screen that is hard to read.
139 | - Nested navigation in UIs is a bad idea too, keep things as flat as possible.
140 | - Nesting tons of folders in your source code is also not helpful.
141 | 2. **Since we need to have more items, here's another one.**
142 | - I'm not sure if we'll bother styling more than two levels deep.
143 | - Two is already too much, three is guaranteed to be a bad idea.
144 | - If you nest four levels deep you belong in prison.
145 | 3. **Two items isn't really a list, three is good though.**
146 | - Again please don't nest lists if you want people to actually read your content.
147 | - Nobody wants to look at this.
148 | - I'm upset that we even have to bother styling this.
149 |
150 | The most annoying thing about lists in Markdown is that `
` elements aren't given a child `
` tag unless there are multiple paragraphs in the list item. That means I have to worry about styling that annoying situation too.
151 |
152 | - **For example, here's another nested list.**
153 |
154 | But this time with a second paragraph.
155 |
156 | - These list items won't have `
` tags
157 | - Because they are only one line each
158 |
159 | - **But in this second top-level list item, they will.**
160 |
161 | This is especially annoying because of the spacing on this paragraph.
162 |
163 | - As you can see here, because I've added a second line, this list item now has a `
` tag.
164 |
165 | This is the second line I'm talking about by the way.
166 |
167 | - Finally here's another list item so it's more like a list.
168 |
169 | - A closing list item, but with no nested list, because why not?
170 |
171 | And finally a sentence to close off this section.
172 |
173 | ## There are other elements we need to style
174 |
175 | I almost forgot to mention links, like [this link to the Tailwind CSS website](https://tailwindcss.com). We almost made them blue but that's so yesterday, so we went with dark gray, feels edgier.
176 |
177 | We even included table styles, check it out:
178 |
179 | | Wrestler | Origin | Finisher |
180 | | ----------------------- | ------------ | ------------------ |
181 | | Bret "The Hitman" Hart | Calgary, AB | Sharpshooter |
182 | | Stone Cold Steve Austin | Austin, TX | Stone Cold Stunner |
183 | | Randy Savage | Sarasota, FL | Elbow Drop |
184 | | Vader | Boulder, CO | Vader Bomb |
185 | | Razor Ramon | Chuluota, FL | Razor's Edge |
186 |
187 | We also need to make sure inline code looks good, like if I wanted to talk about `` elements or tell you the good news about `@tailwindcss/typography`.
188 |
189 | ### Sometimes I even use `code` in headings
190 |
191 | Even though it's probably a bad idea, and historically I've had a hard time making it look good. This _"wrap the code blocks in backticks"_ trick works pretty well though really.
192 |
193 | Another thing I've done in the past is put a `code` tag inside of a link, like if I wanted to tell you about the [`tailwindcss/docs`](https://github.com/tailwindcss/docs) repository. I don't love that there is an underline below the backticks but it is absolutely not worth the madness it would require to avoid it.
194 |
195 | #### We haven't used an `h4` yet
196 |
197 | But now we have. Please don't use `h5` or `h6` in your content, Medium only supports two heading levels for a reason, you animals. I honestly considered using a `before` pseudo-element to scream at you if you use an `h5` or `h6`.
198 |
199 | We don't style them at all out of the box because `h4` elements are already so small that they are the same size as the body copy. What are we supposed to do with an `h5`, make it _smaller_ than the body copy? No thanks.
200 |
201 | ### We still need to think about stacked headings though.
202 |
203 | #### Let's make sure we don't screw that up with `h4` elements, either.
204 |
205 | Phew, with any luck we have styled the headings above this text and they look pretty good.
206 |
207 | Let's add a closing paragraph here so things end with a decently sized block of text. I can't explain why I want things to end that way but I have to assume it's because I think things will look weird or unbalanced if there is a heading too close to the end of the document.
208 |
209 | What I've written here is probably long enough, but adding this final sentence can't hurt.
210 |
211 | ## GitHub Flavored Markdown
212 |
213 | I've also added support for GitHub Flavored Mardown using `remark-gfm`.
214 |
215 | With `remark-gfm`, we get a few extra features in our markdown. Example: autolink literals.
216 |
217 | A link like www.example.com or https://example.com would automatically be converted into an `a` tag.
218 |
219 | This works for email links too: contact@example.com.
--------------------------------------------------------------------------------
/project files/blogs/automating-repetitive-tasks-productivity-hacks-for-developers/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Automating Repetitive Tasks: Productivity Hacks for Developers"
3 | description: How to deploy your Next.js apps on Vercel.
4 | image: "../../public/blogs/emile-perron-xrVDYZRGdw4-unsplash.jpg"
5 | publishedAt: "2023-01-01"
6 | updatedAt: "2023-01-01"
7 | author: "codebucks"
8 | isPublished: true
9 | tags:
10 | - productivity
11 | ---
12 |
13 | Until now, trying to style an article, document, or blog post with Tailwind has been a tedious task that required a keen eye for typography and a lot of complex custom CSS.
14 |
15 | By default, Tailwind removes all of the default browser styling from paragraphs, headings, lists and more. This ends up being really useful for building application UIs because you spend less time undoing user-agent styles, but when you _really are_ just trying to style some content that came from a rich-text editor in a CMS or a markdown file, it can be surprising and unintuitive.
16 |
17 | We get lots of complaints about it actually, with people regularly asking us things like:
18 |
19 | > Why is Tailwind removing the default styles on my `h1` elements? How do I disable this? What do you mean I lose all the other base styles too?
20 | > We hear you, but we're not convinced that simply disabling our base styles is what you really want. You don't want to have to remove annoying margins every time you use a `p` element in a piece of your dashboard UI. And I doubt you really want your blog posts to use the user-agent styles either — you want them to look _awesome_, not awful.
21 |
22 | The `@tailwindcss/typography` plugin is our attempt to give you what you _actually_ want, without any of the downsides of doing something stupid like disabling our base styles.
23 |
24 | It adds a new `prose` class that you can slap on any block of vanilla HTML content and turn it into a beautiful, well-formatted document:
25 |
26 | ```html
27 |
28 |
Garlic bread with cheese: What the science tells us
29 |
30 | For years parents have espoused the health benefits of eating garlic bread
31 | with cheese to their children, with the food earning such an iconic status
32 | in our culture that kids will often dress up as warm, cheesy loaf for
33 | Halloween.
34 |
35 |
36 | But a recent study shows that the celebrated appetizer may be linked to a
37 | series of rabies cases springing up around the country.
38 |
39 |
40 | ```
41 |
42 | For more information about how to use the plugin and the features it includes, [read the documentation](https://github.com/tailwindcss/typography/blob/master/README.md).
43 |
44 | ---
45 |
46 | ## What to expect from here on out
47 |
48 | What follows from here is just a bunch of absolute nonsense I've written to dogfood the plugin itself. It includes every sensible typographic element I could think of, like **bold text**, unordered lists, ordered lists, code blocks, block quotes, _and even italics_.
49 |
50 | It's important to cover all of these use cases for a few reasons:
51 |
52 | 1. We want everything to look good out of the box.
53 | 2. Really just the first reason, that's the whole point of the plugin.
54 | 3. Here's a third pretend reason though a list with three items looks more realistic than a list with two items.
55 |
56 | Now we're going to try out another header style.
57 |
58 | ### Typography should be easy
59 |
60 | So that's a header for you — with any luck if we've done our job correctly that will look pretty reasonable.
61 |
62 | Something a wise person once told me about typography is:
63 |
64 | > Typography is pretty important if you don't want your stuff to look like trash. Make it good then it won't be bad.
65 |
66 | It's probably important that images look okay here by default as well:
67 |
68 |
75 |
76 | Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.
77 |
78 | Now I'm going to show you an example of an unordered list to make sure that looks good, too:
79 |
80 | - So here is the first item in this list.
81 | - In this example we're keeping the items short.
82 | - Later, we'll use longer, more complex list items.
83 |
84 | And that's the end of this section.
85 |
86 | ## What if we stack headings?
87 |
88 | ### We should make sure that looks good, too.
89 |
90 | Sometimes you have headings directly underneath each other. In those cases you often have to undo the top margin on the second heading because it usually looks better for the headings to be closer together than a paragraph followed by a heading should be.
91 |
92 | ### When a heading comes after a paragraph …
93 |
94 | When a heading comes after a paragraph, we need a bit more space, like I already mentioned above. Now let's see what a more complex list would look like.
95 |
96 | - **I often do this thing where list items have headings.**
97 |
98 | For some reason I think this looks cool which is unfortunate because it's pretty annoying to get the styles right.
99 |
100 | I often have two or three paragraphs in these list items, too, so the hard part is getting the spacing between the paragraphs, list item heading, and separate list items to all make sense. Pretty tough honestly, you could make a strong argument that you just shouldn't write this way.
101 |
102 | - **Since this is a list, I need at least two items.**
103 |
104 | I explained what I'm doing already in the previous list item, but a list wouldn't be a list if it only had one item, and we really want this to look realistic. That's why I've added this second list item so I actually have something to look at when writing the styles.
105 |
106 | - **It's not a bad idea to add a third item either.**
107 |
108 | I think it probably would've been fine to just use two items but three is definitely not worse, and since I seem to be having no trouble making up arbitrary things to type, I might as well include it.
109 |
110 | After this sort of list I usually have a closing statement or paragraph, because it kinda looks weird jumping right to a heading.
111 |
112 | ## Code should look okay by default.
113 |
114 | I think most people are going to use [highlight.js](https://highlightjs.org/) or [Prism](https://prismjs.com/) or something if they want to style their code blocks but it wouldn't hurt to make them look _okay_ out of the box, even with no syntax highlighting.
115 |
116 | Here's what a default `tailwind.config.js` file looks like at the time of writing:
117 |
118 | ```js
119 | module.exports = {
120 | purge: [],
121 | theme: {
122 | extend: {},
123 | },
124 | variants: {},
125 | plugins: [],
126 | };
127 | ```
128 |
129 | Hopefully that looks good enough to you.
130 |
131 | ### What about nested lists?
132 |
133 | Nested lists basically always look bad which is why editors like Medium don't even let you do it, but I guess since some of you goofballs are going to do it we have to carry the burden of at least making it work.
134 |
135 | 1. **Nested lists are rarely a good idea.**
136 | - You might feel like you are being really "organized" or something but you are just creating a gross shape on the screen that is hard to read.
137 | - Nested navigation in UIs is a bad idea too, keep things as flat as possible.
138 | - Nesting tons of folders in your source code is also not helpful.
139 | 2. **Since we need to have more items, here's another one.**
140 | - I'm not sure if we'll bother styling more than two levels deep.
141 | - Two is already too much, three is guaranteed to be a bad idea.
142 | - If you nest four levels deep you belong in prison.
143 | 3. **Two items isn't really a list, three is good though.**
144 | - Again please don't nest lists if you want people to actually read your content.
145 | - Nobody wants to look at this.
146 | - I'm upset that we even have to bother styling this.
147 |
148 | The most annoying thing about lists in Markdown is that `
` elements aren't given a child `
` tag unless there are multiple paragraphs in the list item. That means I have to worry about styling that annoying situation too.
149 |
150 | - **For example, here's another nested list.**
151 |
152 | But this time with a second paragraph.
153 |
154 | - These list items won't have `
` tags
155 | - Because they are only one line each
156 |
157 | - **But in this second top-level list item, they will.**
158 |
159 | This is especially annoying because of the spacing on this paragraph.
160 |
161 | - As you can see here, because I've added a second line, this list item now has a `
` tag.
162 |
163 | This is the second line I'm talking about by the way.
164 |
165 | - Finally here's another list item so it's more like a list.
166 |
167 | - A closing list item, but with no nested list, because why not?
168 |
169 | And finally a sentence to close off this section.
170 |
171 | ## There are other elements we need to style
172 |
173 | I almost forgot to mention links, like [this link to the Tailwind CSS website](https://tailwindcss.com). We almost made them blue but that's so yesterday, so we went with dark gray, feels edgier.
174 |
175 | We even included table styles, check it out:
176 |
177 | | Wrestler | Origin | Finisher |
178 | | ----------------------- | ------------ | ------------------ |
179 | | Bret "The Hitman" Hart | Calgary, AB | Sharpshooter |
180 | | Stone Cold Steve Austin | Austin, TX | Stone Cold Stunner |
181 | | Randy Savage | Sarasota, FL | Elbow Drop |
182 | | Vader | Boulder, CO | Vader Bomb |
183 | | Razor Ramon | Chuluota, FL | Razor's Edge |
184 |
185 | We also need to make sure inline code looks good, like if I wanted to talk about `` elements or tell you the good news about `@tailwindcss/typography`.
186 |
187 | ### Sometimes I even use `code` in headings
188 |
189 | Even though it's probably a bad idea, and historically I've had a hard time making it look good. This _"wrap the code blocks in backticks"_ trick works pretty well though really.
190 |
191 | Another thing I've done in the past is put a `code` tag inside of a link, like if I wanted to tell you about the [`tailwindcss/docs`](https://github.com/tailwindcss/docs) repository. I don't love that there is an underline below the backticks but it is absolutely not worth the madness it would require to avoid it.
192 |
193 | #### We haven't used an `h4` yet
194 |
195 | But now we have. Please don't use `h5` or `h6` in your content, Medium only supports two heading levels for a reason, you animals. I honestly considered using a `before` pseudo-element to scream at you if you use an `h5` or `h6`.
196 |
197 | We don't style them at all out of the box because `h4` elements are already so small that they are the same size as the body copy. What are we supposed to do with an `h5`, make it _smaller_ than the body copy? No thanks.
198 |
199 | ### We still need to think about stacked headings though.
200 |
201 | #### Let's make sure we don't screw that up with `h4` elements, either.
202 |
203 | Phew, with any luck we have styled the headings above this text and they look pretty good.
204 |
205 | Let's add a closing paragraph here so things end with a decently sized block of text. I can't explain why I want things to end that way but I have to assume it's because I think things will look weird or unbalanced if there is a heading too close to the end of the document.
206 |
207 | What I've written here is probably long enough, but adding this final sentence can't hurt.
208 |
209 | ## GitHub Flavored Markdown
210 |
211 | I've also added support for GitHub Flavored Mardown using `remark-gfm`.
212 |
213 | With `remark-gfm`, we get a few extra features in our markdown. Example: autolink literals.
214 |
215 | A link like www.example.com or https://example.com would automatically be converted into an `a` tag.
216 |
217 | This works for email links too: contact@example.com.
218 |
--------------------------------------------------------------------------------
/project files/blogs/restful-apis-building-blocks/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "RESTful APIs: Building Blocks of Modern Web Applications"
3 | description: "Uncover the fundamental concepts of RESTful APIs and their crucial role in modern web application development."
4 | image: "../../public/blogs/luca-bravo-XJXWbfSo2f0-unsplash.jpg"
5 | publishedAt: "2022-11-12"
6 | updatedAt: "2022-11-12"
7 | author: "codebucks"
8 | isPublished: true
9 | tags:
10 | - code quality
11 | - web development
12 | ---
13 |
14 |
15 |
16 | Until now, trying to style an article, document, or blog post with Tailwind has been a tedious task that required a keen eye for typography and a lot of complex custom CSS.
17 |
18 | By default, Tailwind removes all of the default browser styling from paragraphs, headings, lists and more. This ends up being really useful for building application UIs because you spend less time undoing user-agent styles, but when you _really are_ just trying to style some content that came from a rich-text editor in a CMS or a markdown file, it can be surprising and unintuitive.
19 |
20 | We get lots of complaints about it actually, with people regularly asking us things like:
21 |
22 | > Why is Tailwind removing the default styles on my `h1` elements? How do I disable this? What do you mean I lose all the other base styles too?
23 | > We hear you, but we're not convinced that simply disabling our base styles is what you really want. You don't want to have to remove annoying margins every time you use a `p` element in a piece of your dashboard UI. And I doubt you really want your blog posts to use the user-agent styles either — you want them to look _awesome_, not awful.
24 |
25 | The `@tailwindcss/typography` plugin is our attempt to give you what you _actually_ want, without any of the downsides of doing something stupid like disabling our base styles.
26 |
27 | It adds a new `prose` class that you can slap on any block of vanilla HTML content and turn it into a beautiful, well-formatted document:
28 |
29 | ```html
30 |
31 |
Garlic bread with cheese: What the science tells us
32 |
33 | For years parents have espoused the health benefits of eating garlic bread
34 | with cheese to their children, with the food earning such an iconic status
35 | in our culture that kids will often dress up as warm, cheesy loaf for
36 | Halloween.
37 |
38 |
39 | But a recent study shows that the celebrated appetizer may be linked to a
40 | series of rabies cases springing up around the country.
41 |
42 |
43 | ```
44 |
45 | For more information about how to use the plugin and the features it includes, [read the documentation](https://github.com/tailwindcss/typography/blob/master/README.md).
46 |
47 | ---
48 |
49 | ## What to expect from here on out
50 |
51 | What follows from here is just a bunch of absolute nonsense I've written to dogfood the plugin itself. It includes every sensible typographic element I could think of, like **bold text**, unordered lists, ordered lists, code blocks, block quotes, _and even italics_.
52 |
53 | It's important to cover all of these use cases for a few reasons:
54 |
55 | 1. We want everything to look good out of the box.
56 | 2. Really just the first reason, that's the whole point of the plugin.
57 | 3. Here's a third pretend reason though a list with three items looks more realistic than a list with two items.
58 |
59 | Now we're going to try out another header style.
60 |
61 | ### Typography should be easy
62 |
63 | So that's a header for you — with any luck if we've done our job correctly that will look pretty reasonable.
64 |
65 | Something a wise person once told me about typography is:
66 |
67 | > Typography is pretty important if you don't want your stuff to look like trash. Make it good then it won't be bad.
68 |
69 | It's probably important that images look okay here by default as well:
70 |
71 |
78 |
79 | Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.
80 |
81 | Now I'm going to show you an example of an unordered list to make sure that looks good, too:
82 |
83 | - So here is the first item in this list.
84 | - In this example we're keeping the items short.
85 | - Later, we'll use longer, more complex list items.
86 |
87 | And that's the end of this section.
88 |
89 | ## What if we stack headings?
90 |
91 | ### We should make sure that looks good, too.
92 |
93 | Sometimes you have headings directly underneath each other. In those cases you often have to undo the top margin on the second heading because it usually looks better for the headings to be closer together than a paragraph followed by a heading should be.
94 |
95 | ### When a heading comes after a paragraph …
96 |
97 | When a heading comes after a paragraph, we need a bit more space, like I already mentioned above. Now let's see what a more complex list would look like.
98 |
99 | - **I often do this thing where list items have headings.**
100 |
101 | For some reason I think this looks cool which is unfortunate because it's pretty annoying to get the styles right.
102 |
103 | I often have two or three paragraphs in these list items, too, so the hard part is getting the spacing between the paragraphs, list item heading, and separate list items to all make sense. Pretty tough honestly, you could make a strong argument that you just shouldn't write this way.
104 |
105 | - **Since this is a list, I need at least two items.**
106 |
107 | I explained what I'm doing already in the previous list item, but a list wouldn't be a list if it only had one item, and we really want this to look realistic. That's why I've added this second list item so I actually have something to look at when writing the styles.
108 |
109 | - **It's not a bad idea to add a third item either.**
110 |
111 | I think it probably would've been fine to just use two items but three is definitely not worse, and since I seem to be having no trouble making up arbitrary things to type, I might as well include it.
112 |
113 | After this sort of list I usually have a closing statement or paragraph, because it kinda looks weird jumping right to a heading.
114 |
115 | ## Code should look okay by default.
116 |
117 | I think most people are going to use [highlight.js](https://highlightjs.org/) or [Prism](https://prismjs.com/) or something if they want to style their code blocks but it wouldn't hurt to make them look _okay_ out of the box, even with no syntax highlighting.
118 |
119 | Here's what a default `tailwind.config.js` file looks like at the time of writing:
120 |
121 | ```js
122 | module.exports = {
123 | purge: [],
124 | theme: {
125 | extend: {},
126 | },
127 | variants: {},
128 | plugins: [],
129 | }
130 | ```
131 |
132 | Hopefully that looks good enough to you.
133 |
134 | ### What about nested lists?
135 |
136 | Nested lists basically always look bad which is why editors like Medium don't even let you do it, but I guess since some of you goofballs are going to do it we have to carry the burden of at least making it work.
137 |
138 | 1. **Nested lists are rarely a good idea.**
139 | - You might feel like you are being really "organized" or something but you are just creating a gross shape on the screen that is hard to read.
140 | - Nested navigation in UIs is a bad idea too, keep things as flat as possible.
141 | - Nesting tons of folders in your source code is also not helpful.
142 | 2. **Since we need to have more items, here's another one.**
143 | - I'm not sure if we'll bother styling more than two levels deep.
144 | - Two is already too much, three is guaranteed to be a bad idea.
145 | - If you nest four levels deep you belong in prison.
146 | 3. **Two items isn't really a list, three is good though.**
147 | - Again please don't nest lists if you want people to actually read your content.
148 | - Nobody wants to look at this.
149 | - I'm upset that we even have to bother styling this.
150 |
151 | The most annoying thing about lists in Markdown is that `
` elements aren't given a child `
` tag unless there are multiple paragraphs in the list item. That means I have to worry about styling that annoying situation too.
152 |
153 | - **For example, here's another nested list.**
154 |
155 | But this time with a second paragraph.
156 |
157 | - These list items won't have `
` tags
158 | - Because they are only one line each
159 |
160 | - **But in this second top-level list item, they will.**
161 |
162 | This is especially annoying because of the spacing on this paragraph.
163 |
164 | - As you can see here, because I've added a second line, this list item now has a `
` tag.
165 |
166 | This is the second line I'm talking about by the way.
167 |
168 | - Finally here's another list item so it's more like a list.
169 |
170 | - A closing list item, but with no nested list, because why not?
171 |
172 | And finally a sentence to close off this section.
173 |
174 | ## There are other elements we need to style
175 |
176 | I almost forgot to mention links, like [this link to the Tailwind CSS website](https://tailwindcss.com). We almost made them blue but that's so yesterday, so we went with dark gray, feels edgier.
177 |
178 | We even included table styles, check it out:
179 |
180 | | Wrestler | Origin | Finisher |
181 | | ----------------------- | ------------ | ------------------ |
182 | | Bret "The Hitman" Hart | Calgary, AB | Sharpshooter |
183 | | Stone Cold Steve Austin | Austin, TX | Stone Cold Stunner |
184 | | Randy Savage | Sarasota, FL | Elbow Drop |
185 | | Vader | Boulder, CO | Vader Bomb |
186 | | Razor Ramon | Chuluota, FL | Razor's Edge |
187 |
188 | We also need to make sure inline code looks good, like if I wanted to talk about `` elements or tell you the good news about `@tailwindcss/typography`.
189 |
190 | ### Sometimes I even use `code` in headings
191 |
192 | Even though it's probably a bad idea, and historically I've had a hard time making it look good. This _"wrap the code blocks in backticks"_ trick works pretty well though really.
193 |
194 | Another thing I've done in the past is put a `code` tag inside of a link, like if I wanted to tell you about the [`tailwindcss/docs`](https://github.com/tailwindcss/docs) repository. I don't love that there is an underline below the backticks but it is absolutely not worth the madness it would require to avoid it.
195 |
196 | #### We haven't used an `h4` yet
197 |
198 | But now we have. Please don't use `h5` or `h6` in your content, Medium only supports two heading levels for a reason, you animals. I honestly considered using a `before` pseudo-element to scream at you if you use an `h5` or `h6`.
199 |
200 | We don't style them at all out of the box because `h4` elements are already so small that they are the same size as the body copy. What are we supposed to do with an `h5`, make it _smaller_ than the body copy? No thanks.
201 |
202 | ### We still need to think about stacked headings though.
203 |
204 | #### Let's make sure we don't screw that up with `h4` elements, either.
205 |
206 | Phew, with any luck we have styled the headings above this text and they look pretty good.
207 |
208 | Let's add a closing paragraph here so things end with a decently sized block of text. I can't explain why I want things to end that way but I have to assume it's because I think things will look weird or unbalanced if there is a heading too close to the end of the document.
209 |
210 | What I've written here is probably long enough, but adding this final sentence can't hurt.
211 |
212 | ## GitHub Flavored Markdown
213 |
214 | I've also added support for GitHub Flavored Mardown using `remark-gfm`.
215 |
216 | With `remark-gfm`, we get a few extra features in our markdown. Example: autolink literals.
217 |
218 | A link like www.example.com or https://example.com would automatically be converted into an `a` tag.
219 |
220 | This works for email links too: contact@example.com.
--------------------------------------------------------------------------------
/project files/blogs/web-accessibility-inclusive-design/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Web Accessibility: Inclusive Design for All Users"
3 | description: "Embrace the principles of web accessibility and ensure that your web applications reach all users, regardless of their abilities."
4 | image: "../../public/blogs/christina-wocintechchat-com-OtHEYbQXLFU-unsplash.jpg"
5 | publishedAt: "2022-11-12"
6 | updatedAt: "2022-11-12"
7 | author: "codebucks"
8 | isPublished: true
9 | tags:
10 | - code quality
11 | - web development
12 | ---
13 |
14 |
15 |
16 | Until now, trying to style an article, document, or blog post with Tailwind has been a tedious task that required a keen eye for typography and a lot of complex custom CSS.
17 |
18 | By default, Tailwind removes all of the default browser styling from paragraphs, headings, lists and more. This ends up being really useful for building application UIs because you spend less time undoing user-agent styles, but when you _really are_ just trying to style some content that came from a rich-text editor in a CMS or a markdown file, it can be surprising and unintuitive.
19 |
20 | We get lots of complaints about it actually, with people regularly asking us things like:
21 |
22 | > Why is Tailwind removing the default styles on my `h1` elements? How do I disable this? What do you mean I lose all the other base styles too?
23 | > We hear you, but we're not convinced that simply disabling our base styles is what you really want. You don't want to have to remove annoying margins every time you use a `p` element in a piece of your dashboard UI. And I doubt you really want your blog posts to use the user-agent styles either — you want them to look _awesome_, not awful.
24 |
25 | The `@tailwindcss/typography` plugin is our attempt to give you what you _actually_ want, without any of the downsides of doing something stupid like disabling our base styles.
26 |
27 | It adds a new `prose` class that you can slap on any block of vanilla HTML content and turn it into a beautiful, well-formatted document:
28 |
29 | ```html
30 |
31 |
Garlic bread with cheese: What the science tells us
32 |
33 | For years parents have espoused the health benefits of eating garlic bread
34 | with cheese to their children, with the food earning such an iconic status
35 | in our culture that kids will often dress up as warm, cheesy loaf for
36 | Halloween.
37 |
38 |
39 | But a recent study shows that the celebrated appetizer may be linked to a
40 | series of rabies cases springing up around the country.
41 |
42 |
43 | ```
44 |
45 | For more information about how to use the plugin and the features it includes, [read the documentation](https://github.com/tailwindcss/typography/blob/master/README.md).
46 |
47 | ---
48 |
49 | ## What to expect from here on out
50 |
51 | What follows from here is just a bunch of absolute nonsense I've written to dogfood the plugin itself. It includes every sensible typographic element I could think of, like **bold text**, unordered lists, ordered lists, code blocks, block quotes, _and even italics_.
52 |
53 | It's important to cover all of these use cases for a few reasons:
54 |
55 | 1. We want everything to look good out of the box.
56 | 2. Really just the first reason, that's the whole point of the plugin.
57 | 3. Here's a third pretend reason though a list with three items looks more realistic than a list with two items.
58 |
59 | Now we're going to try out another header style.
60 |
61 | ### Typography should be easy
62 |
63 | So that's a header for you — with any luck if we've done our job correctly that will look pretty reasonable.
64 |
65 | Something a wise person once told me about typography is:
66 |
67 | > Typography is pretty important if you don't want your stuff to look like trash. Make it good then it won't be bad.
68 |
69 | It's probably important that images look okay here by default as well:
70 |
71 |
78 |
79 | Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.
80 |
81 | Now I'm going to show you an example of an unordered list to make sure that looks good, too:
82 |
83 | - So here is the first item in this list.
84 | - In this example we're keeping the items short.
85 | - Later, we'll use longer, more complex list items.
86 |
87 | And that's the end of this section.
88 |
89 | ## What if we stack headings?
90 |
91 | ### We should make sure that looks good, too.
92 |
93 | Sometimes you have headings directly underneath each other. In those cases you often have to undo the top margin on the second heading because it usually looks better for the headings to be closer together than a paragraph followed by a heading should be.
94 |
95 | ### When a heading comes after a paragraph …
96 |
97 | When a heading comes after a paragraph, we need a bit more space, like I already mentioned above. Now let's see what a more complex list would look like.
98 |
99 | - **I often do this thing where list items have headings.**
100 |
101 | For some reason I think this looks cool which is unfortunate because it's pretty annoying to get the styles right.
102 |
103 | I often have two or three paragraphs in these list items, too, so the hard part is getting the spacing between the paragraphs, list item heading, and separate list items to all make sense. Pretty tough honestly, you could make a strong argument that you just shouldn't write this way.
104 |
105 | - **Since this is a list, I need at least two items.**
106 |
107 | I explained what I'm doing already in the previous list item, but a list wouldn't be a list if it only had one item, and we really want this to look realistic. That's why I've added this second list item so I actually have something to look at when writing the styles.
108 |
109 | - **It's not a bad idea to add a third item either.**
110 |
111 | I think it probably would've been fine to just use two items but three is definitely not worse, and since I seem to be having no trouble making up arbitrary things to type, I might as well include it.
112 |
113 | After this sort of list I usually have a closing statement or paragraph, because it kinda looks weird jumping right to a heading.
114 |
115 | ## Code should look okay by default.
116 |
117 | I think most people are going to use [highlight.js](https://highlightjs.org/) or [Prism](https://prismjs.com/) or something if they want to style their code blocks but it wouldn't hurt to make them look _okay_ out of the box, even with no syntax highlighting.
118 |
119 | Here's what a default `tailwind.config.js` file looks like at the time of writing:
120 |
121 | ```js
122 | module.exports = {
123 | purge: [],
124 | theme: {
125 | extend: {},
126 | },
127 | variants: {},
128 | plugins: [],
129 | }
130 | ```
131 |
132 | Hopefully that looks good enough to you.
133 |
134 | ### What about nested lists?
135 |
136 | Nested lists basically always look bad which is why editors like Medium don't even let you do it, but I guess since some of you goofballs are going to do it we have to carry the burden of at least making it work.
137 |
138 | 1. **Nested lists are rarely a good idea.**
139 | - You might feel like you are being really "organized" or something but you are just creating a gross shape on the screen that is hard to read.
140 | - Nested navigation in UIs is a bad idea too, keep things as flat as possible.
141 | - Nesting tons of folders in your source code is also not helpful.
142 | 2. **Since we need to have more items, here's another one.**
143 | - I'm not sure if we'll bother styling more than two levels deep.
144 | - Two is already too much, three is guaranteed to be a bad idea.
145 | - If you nest four levels deep you belong in prison.
146 | 3. **Two items isn't really a list, three is good though.**
147 | - Again please don't nest lists if you want people to actually read your content.
148 | - Nobody wants to look at this.
149 | - I'm upset that we even have to bother styling this.
150 |
151 | The most annoying thing about lists in Markdown is that `
` elements aren't given a child `
` tag unless there are multiple paragraphs in the list item. That means I have to worry about styling that annoying situation too.
152 |
153 | - **For example, here's another nested list.**
154 |
155 | But this time with a second paragraph.
156 |
157 | - These list items won't have `
` tags
158 | - Because they are only one line each
159 |
160 | - **But in this second top-level list item, they will.**
161 |
162 | This is especially annoying because of the spacing on this paragraph.
163 |
164 | - As you can see here, because I've added a second line, this list item now has a `
` tag.
165 |
166 | This is the second line I'm talking about by the way.
167 |
168 | - Finally here's another list item so it's more like a list.
169 |
170 | - A closing list item, but with no nested list, because why not?
171 |
172 | And finally a sentence to close off this section.
173 |
174 | ## There are other elements we need to style
175 |
176 | I almost forgot to mention links, like [this link to the Tailwind CSS website](https://tailwindcss.com). We almost made them blue but that's so yesterday, so we went with dark gray, feels edgier.
177 |
178 | We even included table styles, check it out:
179 |
180 | | Wrestler | Origin | Finisher |
181 | | ----------------------- | ------------ | ------------------ |
182 | | Bret "The Hitman" Hart | Calgary, AB | Sharpshooter |
183 | | Stone Cold Steve Austin | Austin, TX | Stone Cold Stunner |
184 | | Randy Savage | Sarasota, FL | Elbow Drop |
185 | | Vader | Boulder, CO | Vader Bomb |
186 | | Razor Ramon | Chuluota, FL | Razor's Edge |
187 |
188 | We also need to make sure inline code looks good, like if I wanted to talk about `` elements or tell you the good news about `@tailwindcss/typography`.
189 |
190 | ### Sometimes I even use `code` in headings
191 |
192 | Even though it's probably a bad idea, and historically I've had a hard time making it look good. This _"wrap the code blocks in backticks"_ trick works pretty well though really.
193 |
194 | Another thing I've done in the past is put a `code` tag inside of a link, like if I wanted to tell you about the [`tailwindcss/docs`](https://github.com/tailwindcss/docs) repository. I don't love that there is an underline below the backticks but it is absolutely not worth the madness it would require to avoid it.
195 |
196 | #### We haven't used an `h4` yet
197 |
198 | But now we have. Please don't use `h5` or `h6` in your content, Medium only supports two heading levels for a reason, you animals. I honestly considered using a `before` pseudo-element to scream at you if you use an `h5` or `h6`.
199 |
200 | We don't style them at all out of the box because `h4` elements are already so small that they are the same size as the body copy. What are we supposed to do with an `h5`, make it _smaller_ than the body copy? No thanks.
201 |
202 | ### We still need to think about stacked headings though.
203 |
204 | #### Let's make sure we don't screw that up with `h4` elements, either.
205 |
206 | Phew, with any luck we have styled the headings above this text and they look pretty good.
207 |
208 | Let's add a closing paragraph here so things end with a decently sized block of text. I can't explain why I want things to end that way but I have to assume it's because I think things will look weird or unbalanced if there is a heading too close to the end of the document.
209 |
210 | What I've written here is probably long enough, but adding this final sentence can't hurt.
211 |
212 | ## GitHub Flavored Markdown
213 |
214 | I've also added support for GitHub Flavored Mardown using `remark-gfm`.
215 |
216 | With `remark-gfm`, we get a few extra features in our markdown. Example: autolink literals.
217 |
218 | A link like www.example.com or https://example.com would automatically be converted into an `a` tag.
219 |
220 | This works for email links too: contact@example.com.
--------------------------------------------------------------------------------
/project files/blogs/web-development-tools-productivity/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "10 Essential Web Development Tools for Productivity"
3 | description: "Discover 10 must-have web development tools that can significantly boost your productivity, streamline your workflow, and enhance code quality."
4 | image: "../../public/blogs/lauren-mancke-aOC7TSLb1o8-unsplash.jpg"
5 | publishedAt: "2022-11-12"
6 | updatedAt: "2022-11-12"
7 | author: "codebucks"
8 | isPublished: true
9 | tags:
10 | - productivity
11 | - web development
12 | ---
13 |
14 |
15 |
16 | Until now, trying to style an article, document, or blog post with Tailwind has been a tedious task that required a keen eye for typography and a lot of complex custom CSS.
17 |
18 | By default, Tailwind removes all of the default browser styling from paragraphs, headings, lists and more. This ends up being really useful for building application UIs because you spend less time undoing user-agent styles, but when you _really are_ just trying to style some content that came from a rich-text editor in a CMS or a markdown file, it can be surprising and unintuitive.
19 |
20 | We get lots of complaints about it actually, with people regularly asking us things like:
21 |
22 | > Why is Tailwind removing the default styles on my `h1` elements? How do I disable this? What do you mean I lose all the other base styles too?
23 | > We hear you, but we're not convinced that simply disabling our base styles is what you really want. You don't want to have to remove annoying margins every time you use a `p` element in a piece of your dashboard UI. And I doubt you really want your blog posts to use the user-agent styles either — you want them to look _awesome_, not awful.
24 |
25 | The `@tailwindcss/typography` plugin is our attempt to give you what you _actually_ want, without any of the downsides of doing something stupid like disabling our base styles.
26 |
27 | It adds a new `prose` class that you can slap on any block of vanilla HTML content and turn it into a beautiful, well-formatted document:
28 |
29 | ```html
30 |
31 |
Garlic bread with cheese: What the science tells us
32 |
33 | For years parents have espoused the health benefits of eating garlic bread
34 | with cheese to their children, with the food earning such an iconic status
35 | in our culture that kids will often dress up as warm, cheesy loaf for
36 | Halloween.
37 |
38 |
39 | But a recent study shows that the celebrated appetizer may be linked to a
40 | series of rabies cases springing up around the country.
41 |
42 |
43 | ```
44 |
45 | For more information about how to use the plugin and the features it includes, [read the documentation](https://github.com/tailwindcss/typography/blob/master/README.md).
46 |
47 | ---
48 |
49 | ## What to expect from here on out
50 |
51 | What follows from here is just a bunch of absolute nonsense I've written to dogfood the plugin itself. It includes every sensible typographic element I could think of, like **bold text**, unordered lists, ordered lists, code blocks, block quotes, _and even italics_.
52 |
53 | It's important to cover all of these use cases for a few reasons:
54 |
55 | 1. We want everything to look good out of the box.
56 | 2. Really just the first reason, that's the whole point of the plugin.
57 | 3. Here's a third pretend reason though a list with three items looks more realistic than a list with two items.
58 |
59 | Now we're going to try out another header style.
60 |
61 | ### Typography should be easy
62 |
63 | So that's a header for you — with any luck if we've done our job correctly that will look pretty reasonable.
64 |
65 | Something a wise person once told me about typography is:
66 |
67 | > Typography is pretty important if you don't want your stuff to look like trash. Make it good then it won't be bad.
68 |
69 | It's probably important that images look okay here by default as well:
70 |
71 |
78 |
79 | Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.
80 |
81 | Now I'm going to show you an example of an unordered list to make sure that looks good, too:
82 |
83 | - So here is the first item in this list.
84 | - In this example we're keeping the items short.
85 | - Later, we'll use longer, more complex list items.
86 |
87 | And that's the end of this section.
88 |
89 | ## What if we stack headings?
90 |
91 | ### We should make sure that looks good, too.
92 |
93 | Sometimes you have headings directly underneath each other. In those cases you often have to undo the top margin on the second heading because it usually looks better for the headings to be closer together than a paragraph followed by a heading should be.
94 |
95 | ### When a heading comes after a paragraph …
96 |
97 | When a heading comes after a paragraph, we need a bit more space, like I already mentioned above. Now let's see what a more complex list would look like.
98 |
99 | - **I often do this thing where list items have headings.**
100 |
101 | For some reason I think this looks cool which is unfortunate because it's pretty annoying to get the styles right.
102 |
103 | I often have two or three paragraphs in these list items, too, so the hard part is getting the spacing between the paragraphs, list item heading, and separate list items to all make sense. Pretty tough honestly, you could make a strong argument that you just shouldn't write this way.
104 |
105 | - **Since this is a list, I need at least two items.**
106 |
107 | I explained what I'm doing already in the previous list item, but a list wouldn't be a list if it only had one item, and we really want this to look realistic. That's why I've added this second list item so I actually have something to look at when writing the styles.
108 |
109 | - **It's not a bad idea to add a third item either.**
110 |
111 | I think it probably would've been fine to just use two items but three is definitely not worse, and since I seem to be having no trouble making up arbitrary things to type, I might as well include it.
112 |
113 | After this sort of list I usually have a closing statement or paragraph, because it kinda looks weird jumping right to a heading.
114 |
115 | ## Code should look okay by default.
116 |
117 | I think most people are going to use [highlight.js](https://highlightjs.org/) or [Prism](https://prismjs.com/) or something if they want to style their code blocks but it wouldn't hurt to make them look _okay_ out of the box, even with no syntax highlighting.
118 |
119 | Here's what a default `tailwind.config.js` file looks like at the time of writing:
120 |
121 | ```js
122 | module.exports = {
123 | purge: [],
124 | theme: {
125 | extend: {},
126 | },
127 | variants: {},
128 | plugins: [],
129 | }
130 | ```
131 |
132 | Hopefully that looks good enough to you.
133 |
134 | ### What about nested lists?
135 |
136 | Nested lists basically always look bad which is why editors like Medium don't even let you do it, but I guess since some of you goofballs are going to do it we have to carry the burden of at least making it work.
137 |
138 | 1. **Nested lists are rarely a good idea.**
139 | - You might feel like you are being really "organized" or something but you are just creating a gross shape on the screen that is hard to read.
140 | - Nested navigation in UIs is a bad idea too, keep things as flat as possible.
141 | - Nesting tons of folders in your source code is also not helpful.
142 | 2. **Since we need to have more items, here's another one.**
143 | - I'm not sure if we'll bother styling more than two levels deep.
144 | - Two is already too much, three is guaranteed to be a bad idea.
145 | - If you nest four levels deep you belong in prison.
146 | 3. **Two items isn't really a list, three is good though.**
147 | - Again please don't nest lists if you want people to actually read your content.
148 | - Nobody wants to look at this.
149 | - I'm upset that we even have to bother styling this.
150 |
151 | The most annoying thing about lists in Markdown is that `
` elements aren't given a child `
` tag unless there are multiple paragraphs in the list item. That means I have to worry about styling that annoying situation too.
152 |
153 | - **For example, here's another nested list.**
154 |
155 | But this time with a second paragraph.
156 |
157 | - These list items won't have `
` tags
158 | - Because they are only one line each
159 |
160 | - **But in this second top-level list item, they will.**
161 |
162 | This is especially annoying because of the spacing on this paragraph.
163 |
164 | - As you can see here, because I've added a second line, this list item now has a `
` tag.
165 |
166 | This is the second line I'm talking about by the way.
167 |
168 | - Finally here's another list item so it's more like a list.
169 |
170 | - A closing list item, but with no nested list, because why not?
171 |
172 | And finally a sentence to close off this section.
173 |
174 | ## There are other elements we need to style
175 |
176 | I almost forgot to mention links, like [this link to the Tailwind CSS website](https://tailwindcss.com). We almost made them blue but that's so yesterday, so we went with dark gray, feels edgier.
177 |
178 | We even included table styles, check it out:
179 |
180 | | Wrestler | Origin | Finisher |
181 | | ----------------------- | ------------ | ------------------ |
182 | | Bret "The Hitman" Hart | Calgary, AB | Sharpshooter |
183 | | Stone Cold Steve Austin | Austin, TX | Stone Cold Stunner |
184 | | Randy Savage | Sarasota, FL | Elbow Drop |
185 | | Vader | Boulder, CO | Vader Bomb |
186 | | Razor Ramon | Chuluota, FL | Razor's Edge |
187 |
188 | We also need to make sure inline code looks good, like if I wanted to talk about `` elements or tell you the good news about `@tailwindcss/typography`.
189 |
190 | ### Sometimes I even use `code` in headings
191 |
192 | Even though it's probably a bad idea, and historically I've had a hard time making it look good. This _"wrap the code blocks in backticks"_ trick works pretty well though really.
193 |
194 | Another thing I've done in the past is put a `code` tag inside of a link, like if I wanted to tell you about the [`tailwindcss/docs`](https://github.com/tailwindcss/docs) repository. I don't love that there is an underline below the backticks but it is absolutely not worth the madness it would require to avoid it.
195 |
196 | #### We haven't used an `h4` yet
197 |
198 | But now we have. Please don't use `h5` or `h6` in your content, Medium only supports two heading levels for a reason, you animals. I honestly considered using a `before` pseudo-element to scream at you if you use an `h5` or `h6`.
199 |
200 | We don't style them at all out of the box because `h4` elements are already so small that they are the same size as the body copy. What are we supposed to do with an `h5`, make it _smaller_ than the body copy? No thanks.
201 |
202 | ### We still need to think about stacked headings though.
203 |
204 | #### Let's make sure we don't screw that up with `h4` elements, either.
205 |
206 | Phew, with any luck we have styled the headings above this text and they look pretty good.
207 |
208 | Let's add a closing paragraph here so things end with a decently sized block of text. I can't explain why I want things to end that way but I have to assume it's because I think things will look weird or unbalanced if there is a heading too close to the end of the document.
209 |
210 | What I've written here is probably long enough, but adding this final sentence can't hurt.
211 |
212 | ## GitHub Flavored Markdown
213 |
214 | I've also added support for GitHub Flavored Mardown using `remark-gfm`.
215 |
216 | With `remark-gfm`, we get a few extra features in our markdown. Example: autolink literals.
217 |
218 | A link like www.example.com or https://example.com would automatically be converted into an `a` tag.
219 |
220 | This works for email links too: contact@example.com.
--------------------------------------------------------------------------------
/project files/blogs/building-progressive-web-apps-bridging-the-gap-between-web-and-mobile/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Building Progressive Web Apps: Bridging the Gap Between Web and Mobile"
3 | description: "Integrating mindfulness practices helps developers cultivate present-moment awareness, fostering focus, problem-solving, and work-life balance."
4 | image: "../../public/blogs/charlesdeluvio-cZr2sgaxy3Q-unsplash.jpg"
5 | publishedAt: "2023-01-04"
6 | updatedAt: "2023-01-04"
7 | author: "codebucks"
8 | isPublished: true
9 | tags:
10 | - web development
11 | ---
12 |
13 |
14 |
15 | Until now, trying to style an article, document, or blog post with Tailwind has been a tedious task that required a keen eye for typography and a lot of complex custom CSS.
16 |
17 | By default, Tailwind removes all of the default browser styling from paragraphs, headings, lists and more. This ends up being really useful for building application UIs because you spend less time undoing user-agent styles, but when you _really are_ just trying to style some content that came from a rich-text editor in a CMS or a markdown file, it can be surprising and unintuitive.
18 |
19 | We get lots of complaints about it actually, with people regularly asking us things like:
20 |
21 | > Why is Tailwind removing the default styles on my `h1` elements? How do I disable this? What do you mean I lose all the other base styles too?
22 | > We hear you, but we're not convinced that simply disabling our base styles is what you really want. You don't want to have to remove annoying margins every time you use a `p` element in a piece of your dashboard UI. And I doubt you really want your blog posts to use the user-agent styles either — you want them to look _awesome_, not awful.
23 |
24 | The `@tailwindcss/typography` plugin is our attempt to give you what you _actually_ want, without any of the downsides of doing something stupid like disabling our base styles.
25 |
26 | It adds a new `prose` class that you can slap on any block of vanilla HTML content and turn it into a beautiful, well-formatted document:
27 |
28 | ```html
29 |
30 |
Garlic bread with cheese: What the science tells us
31 |
32 | For years parents have espoused the health benefits of eating garlic bread
33 | with cheese to their children, with the food earning such an iconic status
34 | in our culture that kids will often dress up as warm, cheesy loaf for
35 | Halloween.
36 |
37 |
38 | But a recent study shows that the celebrated appetizer may be linked to a
39 | series of rabies cases springing up around the country.
40 |
41 |
42 | ```
43 |
44 | For more information about how to use the plugin and the features it includes, [read the documentation](https://github.com/tailwindcss/typography/blob/master/README.md).
45 |
46 | ---
47 |
48 | ## What to expect from here on out
49 |
50 | What follows from here is just a bunch of absolute nonsense I've written to dogfood the plugin itself. It includes every sensible typographic element I could think of, like **bold text**, unordered lists, ordered lists, code blocks, block quotes, _and even italics_.
51 |
52 | It's important to cover all of these use cases for a few reasons:
53 |
54 | 1. We want everything to look good out of the box.
55 | 2. Really just the first reason, that's the whole point of the plugin.
56 | 3. Here's a third pretend reason though a list with three items looks more realistic than a list with two items.
57 |
58 | Now we're going to try out another header style.
59 |
60 | ### Typography should be easy
61 |
62 | So that's a header for you — with any luck if we've done our job correctly that will look pretty reasonable.
63 |
64 | Something a wise person once told me about typography is:
65 |
66 | > Typography is pretty important if you don't want your stuff to look like trash. Make it good then it won't be bad.
67 |
68 | It's probably important that images look okay here by default as well:
69 |
70 |
77 |
78 | Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.
79 |
80 | Now I'm going to show you an example of an unordered list to make sure that looks good, too:
81 |
82 | - So here is the first item in this list.
83 | - In this example we're keeping the items short.
84 | - Later, we'll use longer, more complex list items.
85 |
86 | And that's the end of this section.
87 |
88 | ## What if we stack headings?
89 |
90 | ### We should make sure that looks good, too.
91 |
92 | Sometimes you have headings directly underneath each other. In those cases you often have to undo the top margin on the second heading because it usually looks better for the headings to be closer together than a paragraph followed by a heading should be.
93 |
94 | ### When a heading comes after a paragraph …
95 |
96 | When a heading comes after a paragraph, we need a bit more space, like I already mentioned above. Now let's see what a more complex list would look like.
97 |
98 | - **I often do this thing where list items have headings.**
99 |
100 | For some reason I think this looks cool which is unfortunate because it's pretty annoying to get the styles right.
101 |
102 | I often have two or three paragraphs in these list items, too, so the hard part is getting the spacing between the paragraphs, list item heading, and separate list items to all make sense. Pretty tough honestly, you could make a strong argument that you just shouldn't write this way.
103 |
104 | - **Since this is a list, I need at least two items.**
105 |
106 | I explained what I'm doing already in the previous list item, but a list wouldn't be a list if it only had one item, and we really want this to look realistic. That's why I've added this second list item so I actually have something to look at when writing the styles.
107 |
108 | - **It's not a bad idea to add a third item either.**
109 |
110 | I think it probably would've been fine to just use two items but three is definitely not worse, and since I seem to be having no trouble making up arbitrary things to type, I might as well include it.
111 |
112 | After this sort of list I usually have a closing statement or paragraph, because it kinda looks weird jumping right to a heading.
113 |
114 | ## Code should look okay by default.
115 |
116 | I think most people are going to use [highlight.js](https://highlightjs.org/) or [Prism](https://prismjs.com/) or something if they want to style their code blocks but it wouldn't hurt to make them look _okay_ out of the box, even with no syntax highlighting.
117 |
118 | Here's what a default `tailwind.config.js` file looks like at the time of writing:
119 |
120 | ```js
121 | module.exports = {
122 | purge: [],
123 | theme: {
124 | extend: {},
125 | },
126 | variants: {},
127 | plugins: [],
128 | }
129 | ```
130 |
131 | Hopefully that looks good enough to you.
132 |
133 | ### What about nested lists?
134 |
135 | Nested lists basically always look bad which is why editors like Medium don't even let you do it, but I guess since some of you goofballs are going to do it we have to carry the burden of at least making it work.
136 |
137 | 1. **Nested lists are rarely a good idea.**
138 | - You might feel like you are being really "organized" or something but you are just creating a gross shape on the screen that is hard to read.
139 | - Nested navigation in UIs is a bad idea too, keep things as flat as possible.
140 | - Nesting tons of folders in your source code is also not helpful.
141 | 2. **Since we need to have more items, here's another one.**
142 | - I'm not sure if we'll bother styling more than two levels deep.
143 | - Two is already too much, three is guaranteed to be a bad idea.
144 | - If you nest four levels deep you belong in prison.
145 | 3. **Two items isn't really a list, three is good though.**
146 | - Again please don't nest lists if you want people to actually read your content.
147 | - Nobody wants to look at this.
148 | - I'm upset that we even have to bother styling this.
149 |
150 | The most annoying thing about lists in Markdown is that `
` elements aren't given a child `
` tag unless there are multiple paragraphs in the list item. That means I have to worry about styling that annoying situation too.
151 |
152 | - **For example, here's another nested list.**
153 |
154 | But this time with a second paragraph.
155 |
156 | - These list items won't have `
` tags
157 | - Because they are only one line each
158 |
159 | - **But in this second top-level list item, they will.**
160 |
161 | This is especially annoying because of the spacing on this paragraph.
162 |
163 | - As you can see here, because I've added a second line, this list item now has a `
` tag.
164 |
165 | This is the second line I'm talking about by the way.
166 |
167 | - Finally here's another list item so it's more like a list.
168 |
169 | - A closing list item, but with no nested list, because why not?
170 |
171 | And finally a sentence to close off this section.
172 |
173 | ## There are other elements we need to style
174 |
175 | I almost forgot to mention links, like [this link to the Tailwind CSS website](https://tailwindcss.com). We almost made them blue but that's so yesterday, so we went with dark gray, feels edgier.
176 |
177 | We even included table styles, check it out:
178 |
179 | | Wrestler | Origin | Finisher |
180 | | ----------------------- | ------------ | ------------------ |
181 | | Bret "The Hitman" Hart | Calgary, AB | Sharpshooter |
182 | | Stone Cold Steve Austin | Austin, TX | Stone Cold Stunner |
183 | | Randy Savage | Sarasota, FL | Elbow Drop |
184 | | Vader | Boulder, CO | Vader Bomb |
185 | | Razor Ramon | Chuluota, FL | Razor's Edge |
186 |
187 | We also need to make sure inline code looks good, like if I wanted to talk about `` elements or tell you the good news about `@tailwindcss/typography`.
188 |
189 | ### Sometimes I even use `code` in headings
190 |
191 | Even though it's probably a bad idea, and historically I've had a hard time making it look good. This _"wrap the code blocks in backticks"_ trick works pretty well though really.
192 |
193 | Another thing I've done in the past is put a `code` tag inside of a link, like if I wanted to tell you about the [`tailwindcss/docs`](https://github.com/tailwindcss/docs) repository. I don't love that there is an underline below the backticks but it is absolutely not worth the madness it would require to avoid it.
194 |
195 | #### We haven't used an `h4` yet
196 |
197 | But now we have. Please don't use `h5` or `h6` in your content, Medium only supports two heading levels for a reason, you animals. I honestly considered using a `before` pseudo-element to scream at you if you use an `h5` or `h6`.
198 |
199 | We don't style them at all out of the box because `h4` elements are already so small that they are the same size as the body copy. What are we supposed to do with an `h5`, make it _smaller_ than the body copy? No thanks.
200 |
201 | ### We still need to think about stacked headings though.
202 |
203 | #### Let's make sure we don't screw that up with `h4` elements, either.
204 |
205 | Phew, with any luck we have styled the headings above this text and they look pretty good.
206 |
207 | Let's add a closing paragraph here so things end with a decently sized block of text. I can't explain why I want things to end that way but I have to assume it's because I think things will look weird or unbalanced if there is a heading too close to the end of the document.
208 |
209 | What I've written here is probably long enough, but adding this final sentence can't hurt.
210 |
211 | ## GitHub Flavored Markdown
212 |
213 | I've also added support for GitHub Flavored Mardown using `remark-gfm`.
214 |
215 | With `remark-gfm`, we get a few extra features in our markdown. Example: autolink literals.
216 |
217 | A link like www.example.com or https://example.com would automatically be converted into an `a` tag.
218 |
219 | This works for email links too: contact@example.com.
--------------------------------------------------------------------------------
/project files/blogs/mastering-css-grid-layout/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Mastering CSS Grid Layout: A Comprehensive Guide"
3 | description: "Dive into the world of CSS Grid Layout with this comprehensive guide. Learn how to create responsive and dynamic layouts using CSS Grid, and explore various examples and best practices for building modern web interfaces."
4 | image: "../../public/blogs/kelly-sikkema--1_RZL8BGBM-unsplash.jpg"
5 | publishedAt: "2022-11-12"
6 | updatedAt: "2022-11-12"
7 | author: "codebucks"
8 | isPublished: true
9 | tags:
10 | - css
11 | - web development
12 | ---
13 |
14 |
15 |
16 | Until now, trying to style an article, document, or blog post with Tailwind has been a tedious task that required a keen eye for typography and a lot of complex custom CSS.
17 |
18 | By default, Tailwind removes all of the default browser styling from paragraphs, headings, lists and more. This ends up being really useful for building application UIs because you spend less time undoing user-agent styles, but when you _really are_ just trying to style some content that came from a rich-text editor in a CMS or a markdown file, it can be surprising and unintuitive.
19 |
20 | We get lots of complaints about it actually, with people regularly asking us things like:
21 |
22 | > Why is Tailwind removing the default styles on my `h1` elements? How do I disable this? What do you mean I lose all the other base styles too?
23 | > We hear you, but we're not convinced that simply disabling our base styles is what you really want. You don't want to have to remove annoying margins every time you use a `p` element in a piece of your dashboard UI. And I doubt you really want your blog posts to use the user-agent styles either — you want them to look _awesome_, not awful.
24 |
25 | The `@tailwindcss/typography` plugin is our attempt to give you what you _actually_ want, without any of the downsides of doing something stupid like disabling our base styles.
26 |
27 | It adds a new `prose` class that you can slap on any block of vanilla HTML content and turn it into a beautiful, well-formatted document:
28 |
29 | ```html
30 |
31 |
Garlic bread with cheese: What the science tells us
32 |
33 | For years parents have espoused the health benefits of eating garlic bread
34 | with cheese to their children, with the food earning such an iconic status
35 | in our culture that kids will often dress up as warm, cheesy loaf for
36 | Halloween.
37 |
38 |
39 | But a recent study shows that the celebrated appetizer may be linked to a
40 | series of rabies cases springing up around the country.
41 |
42 |
43 | ```
44 |
45 | For more information about how to use the plugin and the features it includes, [read the documentation](https://github.com/tailwindcss/typography/blob/master/README.md).
46 |
47 | ---
48 |
49 | ## What to expect from here on out
50 |
51 | What follows from here is just a bunch of absolute nonsense I've written to dogfood the plugin itself. It includes every sensible typographic element I could think of, like **bold text**, unordered lists, ordered lists, code blocks, block quotes, _and even italics_.
52 |
53 | It's important to cover all of these use cases for a few reasons:
54 |
55 | 1. We want everything to look good out of the box.
56 | 2. Really just the first reason, that's the whole point of the plugin.
57 | 3. Here's a third pretend reason though a list with three items looks more realistic than a list with two items.
58 |
59 | Now we're going to try out another header style.
60 |
61 | ### Typography should be easy
62 |
63 | So that's a header for you — with any luck if we've done our job correctly that will look pretty reasonable.
64 |
65 | Something a wise person once told me about typography is:
66 |
67 | > Typography is pretty important if you don't want your stuff to look like trash. Make it good then it won't be bad.
68 |
69 | It's probably important that images look okay here by default as well:
70 |
71 |
78 |
79 | Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.
80 |
81 | Now I'm going to show you an example of an unordered list to make sure that looks good, too:
82 |
83 | - So here is the first item in this list.
84 | - In this example we're keeping the items short.
85 | - Later, we'll use longer, more complex list items.
86 |
87 | And that's the end of this section.
88 |
89 | ## What if we stack headings?
90 |
91 | ### We should make sure that looks good, too.
92 |
93 | Sometimes you have headings directly underneath each other. In those cases you often have to undo the top margin on the second heading because it usually looks better for the headings to be closer together than a paragraph followed by a heading should be.
94 |
95 | ### When a heading comes after a paragraph …
96 |
97 | When a heading comes after a paragraph, we need a bit more space, like I already mentioned above. Now let's see what a more complex list would look like.
98 |
99 | - **I often do this thing where list items have headings.**
100 |
101 | For some reason I think this looks cool which is unfortunate because it's pretty annoying to get the styles right.
102 |
103 | I often have two or three paragraphs in these list items, too, so the hard part is getting the spacing between the paragraphs, list item heading, and separate list items to all make sense. Pretty tough honestly, you could make a strong argument that you just shouldn't write this way.
104 |
105 | - **Since this is a list, I need at least two items.**
106 |
107 | I explained what I'm doing already in the previous list item, but a list wouldn't be a list if it only had one item, and we really want this to look realistic. That's why I've added this second list item so I actually have something to look at when writing the styles.
108 |
109 | - **It's not a bad idea to add a third item either.**
110 |
111 | I think it probably would've been fine to just use two items but three is definitely not worse, and since I seem to be having no trouble making up arbitrary things to type, I might as well include it.
112 |
113 | After this sort of list I usually have a closing statement or paragraph, because it kinda looks weird jumping right to a heading.
114 |
115 | ## Code should look okay by default.
116 |
117 | I think most people are going to use [highlight.js](https://highlightjs.org/) or [Prism](https://prismjs.com/) or something if they want to style their code blocks but it wouldn't hurt to make them look _okay_ out of the box, even with no syntax highlighting.
118 |
119 | Here's what a default `tailwind.config.js` file looks like at the time of writing:
120 |
121 | ```js
122 | module.exports = {
123 | purge: [],
124 | theme: {
125 | extend: {},
126 | },
127 | variants: {},
128 | plugins: [],
129 | }
130 | ```
131 |
132 | Hopefully that looks good enough to you.
133 |
134 | ### What about nested lists?
135 |
136 | Nested lists basically always look bad which is why editors like Medium don't even let you do it, but I guess since some of you goofballs are going to do it we have to carry the burden of at least making it work.
137 |
138 | 1. **Nested lists are rarely a good idea.**
139 | - You might feel like you are being really "organized" or something but you are just creating a gross shape on the screen that is hard to read.
140 | - Nested navigation in UIs is a bad idea too, keep things as flat as possible.
141 | - Nesting tons of folders in your source code is also not helpful.
142 | 2. **Since we need to have more items, here's another one.**
143 | - I'm not sure if we'll bother styling more than two levels deep.
144 | - Two is already too much, three is guaranteed to be a bad idea.
145 | - If you nest four levels deep you belong in prison.
146 | 3. **Two items isn't really a list, three is good though.**
147 | - Again please don't nest lists if you want people to actually read your content.
148 | - Nobody wants to look at this.
149 | - I'm upset that we even have to bother styling this.
150 |
151 | The most annoying thing about lists in Markdown is that `
` elements aren't given a child `
` tag unless there are multiple paragraphs in the list item. That means I have to worry about styling that annoying situation too.
152 |
153 | - **For example, here's another nested list.**
154 |
155 | But this time with a second paragraph.
156 |
157 | - These list items won't have `
` tags
158 | - Because they are only one line each
159 |
160 | - **But in this second top-level list item, they will.**
161 |
162 | This is especially annoying because of the spacing on this paragraph.
163 |
164 | - As you can see here, because I've added a second line, this list item now has a `
` tag.
165 |
166 | This is the second line I'm talking about by the way.
167 |
168 | - Finally here's another list item so it's more like a list.
169 |
170 | - A closing list item, but with no nested list, because why not?
171 |
172 | And finally a sentence to close off this section.
173 |
174 | ## There are other elements we need to style
175 |
176 | I almost forgot to mention links, like [this link to the Tailwind CSS website](https://tailwindcss.com). We almost made them blue but that's so yesterday, so we went with dark gray, feels edgier.
177 |
178 | We even included table styles, check it out:
179 |
180 | | Wrestler | Origin | Finisher |
181 | | ----------------------- | ------------ | ------------------ |
182 | | Bret "The Hitman" Hart | Calgary, AB | Sharpshooter |
183 | | Stone Cold Steve Austin | Austin, TX | Stone Cold Stunner |
184 | | Randy Savage | Sarasota, FL | Elbow Drop |
185 | | Vader | Boulder, CO | Vader Bomb |
186 | | Razor Ramon | Chuluota, FL | Razor's Edge |
187 |
188 | We also need to make sure inline code looks good, like if I wanted to talk about `` elements or tell you the good news about `@tailwindcss/typography`.
189 |
190 | ### Sometimes I even use `code` in headings
191 |
192 | Even though it's probably a bad idea, and historically I've had a hard time making it look good. This _"wrap the code blocks in backticks"_ trick works pretty well though really.
193 |
194 | Another thing I've done in the past is put a `code` tag inside of a link, like if I wanted to tell you about the [`tailwindcss/docs`](https://github.com/tailwindcss/docs) repository. I don't love that there is an underline below the backticks but it is absolutely not worth the madness it would require to avoid it.
195 |
196 | #### We haven't used an `h4` yet
197 |
198 | But now we have. Please don't use `h5` or `h6` in your content, Medium only supports two heading levels for a reason, you animals. I honestly considered using a `before` pseudo-element to scream at you if you use an `h5` or `h6`.
199 |
200 | We don't style them at all out of the box because `h4` elements are already so small that they are the same size as the body copy. What are we supposed to do with an `h5`, make it _smaller_ than the body copy? No thanks.
201 |
202 | ### We still need to think about stacked headings though.
203 |
204 | #### Let's make sure we don't screw that up with `h4` elements, either.
205 |
206 | Phew, with any luck we have styled the headings above this text and they look pretty good.
207 |
208 | Let's add a closing paragraph here so things end with a decently sized block of text. I can't explain why I want things to end that way but I have to assume it's because I think things will look weird or unbalanced if there is a heading too close to the end of the document.
209 |
210 | What I've written here is probably long enough, but adding this final sentence can't hurt.
211 |
212 | ## GitHub Flavored Markdown
213 |
214 | I've also added support for GitHub Flavored Mardown using `remark-gfm`.
215 |
216 | With `remark-gfm`, we get a few extra features in our markdown. Example: autolink literals.
217 |
218 | A link like www.example.com or https://example.com would automatically be converted into an `a` tag.
219 |
220 | This works for email links too: contact@example.com.
--------------------------------------------------------------------------------
/project files/blogs/progressive-web-apps-pwa/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "The Rise of Progressive Web Apps (PWAs): A Game Changer in Web Development"
3 | description: "Progressive Web Apps (PWAs) have transformed how users interact with web applications. Learn about the benefits of PWAs, their architecture, and how to build highly performant, offline-capable web apps using modern web technologies."
4 | image: "../../public/blogs/carlos-muza-hpjSkU2UYSU-unsplash.jpg"
5 | publishedAt: "2022-11-12"
6 | updatedAt: "2022-11-12"
7 | author: "codebucks"
8 | isPublished: true
9 | tags:
10 | - PWA
11 | ---
12 |
13 |
14 |
15 | Until now, trying to style an article, document, or blog post with Tailwind has been a tedious task that required a keen eye for typography and a lot of complex custom CSS.
16 |
17 | By default, Tailwind removes all of the default browser styling from paragraphs, headings, lists and more. This ends up being really useful for building application UIs because you spend less time undoing user-agent styles, but when you _really are_ just trying to style some content that came from a rich-text editor in a CMS or a markdown file, it can be surprising and unintuitive.
18 |
19 | We get lots of complaints about it actually, with people regularly asking us things like:
20 |
21 | > Why is Tailwind removing the default styles on my `h1` elements? How do I disable this? What do you mean I lose all the other base styles too?
22 | > We hear you, but we're not convinced that simply disabling our base styles is what you really want. You don't want to have to remove annoying margins every time you use a `p` element in a piece of your dashboard UI. And I doubt you really want your blog posts to use the user-agent styles either — you want them to look _awesome_, not awful.
23 |
24 | The `@tailwindcss/typography` plugin is our attempt to give you what you _actually_ want, without any of the downsides of doing something stupid like disabling our base styles.
25 |
26 | It adds a new `prose` class that you can slap on any block of vanilla HTML content and turn it into a beautiful, well-formatted document:
27 |
28 | ```html
29 |
30 |
Garlic bread with cheese: What the science tells us
31 |
32 | For years parents have espoused the health benefits of eating garlic bread
33 | with cheese to their children, with the food earning such an iconic status
34 | in our culture that kids will often dress up as warm, cheesy loaf for
35 | Halloween.
36 |
37 |
38 | But a recent study shows that the celebrated appetizer may be linked to a
39 | series of rabies cases springing up around the country.
40 |
41 |
42 | ```
43 |
44 | For more information about how to use the plugin and the features it includes, [read the documentation](https://github.com/tailwindcss/typography/blob/master/README.md).
45 |
46 | ---
47 |
48 | ## What to expect from here on out
49 |
50 | What follows from here is just a bunch of absolute nonsense I've written to dogfood the plugin itself. It includes every sensible typographic element I could think of, like **bold text**, unordered lists, ordered lists, code blocks, block quotes, _and even italics_.
51 |
52 | It's important to cover all of these use cases for a few reasons:
53 |
54 | 1. We want everything to look good out of the box.
55 | 2. Really just the first reason, that's the whole point of the plugin.
56 | 3. Here's a third pretend reason though a list with three items looks more realistic than a list with two items.
57 |
58 | Now we're going to try out another header style.
59 |
60 | ### Typography should be easy
61 |
62 | So that's a header for you — with any luck if we've done our job correctly that will look pretty reasonable.
63 |
64 | Something a wise person once told me about typography is:
65 |
66 | > Typography is pretty important if you don't want your stuff to look like trash. Make it good then it won't be bad.
67 |
68 | It's probably important that images look okay here by default as well:
69 |
70 |
77 |
78 | Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.
79 |
80 | Now I'm going to show you an example of an unordered list to make sure that looks good, too:
81 |
82 | - So here is the first item in this list.
83 | - In this example we're keeping the items short.
84 | - Later, we'll use longer, more complex list items.
85 |
86 | And that's the end of this section.
87 |
88 | ## What if we stack headings?
89 |
90 | ### We should make sure that looks good, too.
91 |
92 | Sometimes you have headings directly underneath each other. In those cases you often have to undo the top margin on the second heading because it usually looks better for the headings to be closer together than a paragraph followed by a heading should be.
93 |
94 | ### When a heading comes after a paragraph …
95 |
96 | When a heading comes after a paragraph, we need a bit more space, like I already mentioned above. Now let's see what a more complex list would look like.
97 |
98 | - **I often do this thing where list items have headings.**
99 |
100 | For some reason I think this looks cool which is unfortunate because it's pretty annoying to get the styles right.
101 |
102 | I often have two or three paragraphs in these list items, too, so the hard part is getting the spacing between the paragraphs, list item heading, and separate list items to all make sense. Pretty tough honestly, you could make a strong argument that you just shouldn't write this way.
103 |
104 | - **Since this is a list, I need at least two items.**
105 |
106 | I explained what I'm doing already in the previous list item, but a list wouldn't be a list if it only had one item, and we really want this to look realistic. That's why I've added this second list item so I actually have something to look at when writing the styles.
107 |
108 | - **It's not a bad idea to add a third item either.**
109 |
110 | I think it probably would've been fine to just use two items but three is definitely not worse, and since I seem to be having no trouble making up arbitrary things to type, I might as well include it.
111 |
112 | After this sort of list I usually have a closing statement or paragraph, because it kinda looks weird jumping right to a heading.
113 |
114 | ## Code should look okay by default.
115 |
116 | I think most people are going to use [highlight.js](https://highlightjs.org/) or [Prism](https://prismjs.com/) or something if they want to style their code blocks but it wouldn't hurt to make them look _okay_ out of the box, even with no syntax highlighting.
117 |
118 | Here's what a default `tailwind.config.js` file looks like at the time of writing:
119 |
120 | ```js
121 | module.exports = {
122 | purge: [],
123 | theme: {
124 | extend: {},
125 | },
126 | variants: {},
127 | plugins: [],
128 | }
129 | ```
130 |
131 | Hopefully that looks good enough to you.
132 |
133 | ### What about nested lists?
134 |
135 | Nested lists basically always look bad which is why editors like Medium don't even let you do it, but I guess since some of you goofballs are going to do it we have to carry the burden of at least making it work.
136 |
137 | 1. **Nested lists are rarely a good idea.**
138 | - You might feel like you are being really "organized" or something but you are just creating a gross shape on the screen that is hard to read.
139 | - Nested navigation in UIs is a bad idea too, keep things as flat as possible.
140 | - Nesting tons of folders in your source code is also not helpful.
141 | 2. **Since we need to have more items, here's another one.**
142 | - I'm not sure if we'll bother styling more than two levels deep.
143 | - Two is already too much, three is guaranteed to be a bad idea.
144 | - If you nest four levels deep you belong in prison.
145 | 3. **Two items isn't really a list, three is good though.**
146 | - Again please don't nest lists if you want people to actually read your content.
147 | - Nobody wants to look at this.
148 | - I'm upset that we even have to bother styling this.
149 |
150 | The most annoying thing about lists in Markdown is that `
` elements aren't given a child `
` tag unless there are multiple paragraphs in the list item. That means I have to worry about styling that annoying situation too.
151 |
152 | - **For example, here's another nested list.**
153 |
154 | But this time with a second paragraph.
155 |
156 | - These list items won't have `
` tags
157 | - Because they are only one line each
158 |
159 | - **But in this second top-level list item, they will.**
160 |
161 | This is especially annoying because of the spacing on this paragraph.
162 |
163 | - As you can see here, because I've added a second line, this list item now has a `
` tag.
164 |
165 | This is the second line I'm talking about by the way.
166 |
167 | - Finally here's another list item so it's more like a list.
168 |
169 | - A closing list item, but with no nested list, because why not?
170 |
171 | And finally a sentence to close off this section.
172 |
173 | ## There are other elements we need to style
174 |
175 | I almost forgot to mention links, like [this link to the Tailwind CSS website](https://tailwindcss.com). We almost made them blue but that's so yesterday, so we went with dark gray, feels edgier.
176 |
177 | We even included table styles, check it out:
178 |
179 | | Wrestler | Origin | Finisher |
180 | | ----------------------- | ------------ | ------------------ |
181 | | Bret "The Hitman" Hart | Calgary, AB | Sharpshooter |
182 | | Stone Cold Steve Austin | Austin, TX | Stone Cold Stunner |
183 | | Randy Savage | Sarasota, FL | Elbow Drop |
184 | | Vader | Boulder, CO | Vader Bomb |
185 | | Razor Ramon | Chuluota, FL | Razor's Edge |
186 |
187 | We also need to make sure inline code looks good, like if I wanted to talk about `` elements or tell you the good news about `@tailwindcss/typography`.
188 |
189 | ### Sometimes I even use `code` in headings
190 |
191 | Even though it's probably a bad idea, and historically I've had a hard time making it look good. This _"wrap the code blocks in backticks"_ trick works pretty well though really.
192 |
193 | Another thing I've done in the past is put a `code` tag inside of a link, like if I wanted to tell you about the [`tailwindcss/docs`](https://github.com/tailwindcss/docs) repository. I don't love that there is an underline below the backticks but it is absolutely not worth the madness it would require to avoid it.
194 |
195 | #### We haven't used an `h4` yet
196 |
197 | But now we have. Please don't use `h5` or `h6` in your content, Medium only supports two heading levels for a reason, you animals. I honestly considered using a `before` pseudo-element to scream at you if you use an `h5` or `h6`.
198 |
199 | We don't style them at all out of the box because `h4` elements are already so small that they are the same size as the body copy. What are we supposed to do with an `h5`, make it _smaller_ than the body copy? No thanks.
200 |
201 | ### We still need to think about stacked headings though.
202 |
203 | #### Let's make sure we don't screw that up with `h4` elements, either.
204 |
205 | Phew, with any luck we have styled the headings above this text and they look pretty good.
206 |
207 | Let's add a closing paragraph here so things end with a decently sized block of text. I can't explain why I want things to end that way but I have to assume it's because I think things will look weird or unbalanced if there is a heading too close to the end of the document.
208 |
209 | What I've written here is probably long enough, but adding this final sentence can't hurt.
210 |
211 | ## GitHub Flavored Markdown
212 |
213 | I've also added support for GitHub Flavored Mardown using `remark-gfm`.
214 |
215 | With `remark-gfm`, we get a few extra features in our markdown. Example: autolink literals.
216 |
217 | A link like www.example.com or https://example.com would automatically be converted into an `a` tag.
218 |
219 | This works for email links too: contact@example.com.
--------------------------------------------------------------------------------
/project files/blogs/web-accessibility-best-practices/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Best Practices for Web Accessibility: Building Inclusive Websites"
3 | description: "Ensuring web accessibility is vital for reaching a broader audience and creating inclusive digital experiences. This blog highlights essential web accessibility best practices, guidelines, and tools to make your websites accessible to everyone."
4 | image: "../../public/blogs/marvin-meyer-SYTO3xs06fU-unsplash.jpg"
5 | publishedAt: "2022-11-12"
6 | updatedAt: "2022-11-12"
7 | author: "codebucks"
8 | isPublished: true
9 | tags:
10 | - code quality
11 | ---
12 |
13 |
14 |
15 | Until now, trying to style an article, document, or blog post with Tailwind has been a tedious task that required a keen eye for typography and a lot of complex custom CSS.
16 |
17 | By default, Tailwind removes all of the default browser styling from paragraphs, headings, lists and more. This ends up being really useful for building application UIs because you spend less time undoing user-agent styles, but when you _really are_ just trying to style some content that came from a rich-text editor in a CMS or a markdown file, it can be surprising and unintuitive.
18 |
19 | We get lots of complaints about it actually, with people regularly asking us things like:
20 |
21 | > Why is Tailwind removing the default styles on my `h1` elements? How do I disable this? What do you mean I lose all the other base styles too?
22 | > We hear you, but we're not convinced that simply disabling our base styles is what you really want. You don't want to have to remove annoying margins every time you use a `p` element in a piece of your dashboard UI. And I doubt you really want your blog posts to use the user-agent styles either — you want them to look _awesome_, not awful.
23 |
24 | The `@tailwindcss/typography` plugin is our attempt to give you what you _actually_ want, without any of the downsides of doing something stupid like disabling our base styles.
25 |
26 | It adds a new `prose` class that you can slap on any block of vanilla HTML content and turn it into a beautiful, well-formatted document:
27 |
28 | ```html
29 |
30 |
Garlic bread with cheese: What the science tells us
31 |
32 | For years parents have espoused the health benefits of eating garlic bread
33 | with cheese to their children, with the food earning such an iconic status
34 | in our culture that kids will often dress up as warm, cheesy loaf for
35 | Halloween.
36 |
37 |
38 | But a recent study shows that the celebrated appetizer may be linked to a
39 | series of rabies cases springing up around the country.
40 |
41 |
42 | ```
43 |
44 | For more information about how to use the plugin and the features it includes, [read the documentation](https://github.com/tailwindcss/typography/blob/master/README.md).
45 |
46 | ---
47 |
48 | ## What to expect from here on out
49 |
50 | What follows from here is just a bunch of absolute nonsense I've written to dogfood the plugin itself. It includes every sensible typographic element I could think of, like **bold text**, unordered lists, ordered lists, code blocks, block quotes, _and even italics_.
51 |
52 | It's important to cover all of these use cases for a few reasons:
53 |
54 | 1. We want everything to look good out of the box.
55 | 2. Really just the first reason, that's the whole point of the plugin.
56 | 3. Here's a third pretend reason though a list with three items looks more realistic than a list with two items.
57 |
58 | Now we're going to try out another header style.
59 |
60 | ### Typography should be easy
61 |
62 | So that's a header for you — with any luck if we've done our job correctly that will look pretty reasonable.
63 |
64 | Something a wise person once told me about typography is:
65 |
66 | > Typography is pretty important if you don't want your stuff to look like trash. Make it good then it won't be bad.
67 |
68 | It's probably important that images look okay here by default as well:
69 |
70 |
77 |
78 | Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.
79 |
80 | Now I'm going to show you an example of an unordered list to make sure that looks good, too:
81 |
82 | - So here is the first item in this list.
83 | - In this example we're keeping the items short.
84 | - Later, we'll use longer, more complex list items.
85 |
86 | And that's the end of this section.
87 |
88 | ## What if we stack headings?
89 |
90 | ### We should make sure that looks good, too.
91 |
92 | Sometimes you have headings directly underneath each other. In those cases you often have to undo the top margin on the second heading because it usually looks better for the headings to be closer together than a paragraph followed by a heading should be.
93 |
94 | ### When a heading comes after a paragraph …
95 |
96 | When a heading comes after a paragraph, we need a bit more space, like I already mentioned above. Now let's see what a more complex list would look like.
97 |
98 | - **I often do this thing where list items have headings.**
99 |
100 | For some reason I think this looks cool which is unfortunate because it's pretty annoying to get the styles right.
101 |
102 | I often have two or three paragraphs in these list items, too, so the hard part is getting the spacing between the paragraphs, list item heading, and separate list items to all make sense. Pretty tough honestly, you could make a strong argument that you just shouldn't write this way.
103 |
104 | - **Since this is a list, I need at least two items.**
105 |
106 | I explained what I'm doing already in the previous list item, but a list wouldn't be a list if it only had one item, and we really want this to look realistic. That's why I've added this second list item so I actually have something to look at when writing the styles.
107 |
108 | - **It's not a bad idea to add a third item either.**
109 |
110 | I think it probably would've been fine to just use two items but three is definitely not worse, and since I seem to be having no trouble making up arbitrary things to type, I might as well include it.
111 |
112 | After this sort of list I usually have a closing statement or paragraph, because it kinda looks weird jumping right to a heading.
113 |
114 | ## Code should look okay by default.
115 |
116 | I think most people are going to use [highlight.js](https://highlightjs.org/) or [Prism](https://prismjs.com/) or something if they want to style their code blocks but it wouldn't hurt to make them look _okay_ out of the box, even with no syntax highlighting.
117 |
118 | Here's what a default `tailwind.config.js` file looks like at the time of writing:
119 |
120 | ```js
121 | module.exports = {
122 | purge: [],
123 | theme: {
124 | extend: {},
125 | },
126 | variants: {},
127 | plugins: [],
128 | }
129 | ```
130 |
131 | Hopefully that looks good enough to you.
132 |
133 | ### What about nested lists?
134 |
135 | Nested lists basically always look bad which is why editors like Medium don't even let you do it, but I guess since some of you goofballs are going to do it we have to carry the burden of at least making it work.
136 |
137 | 1. **Nested lists are rarely a good idea.**
138 | - You might feel like you are being really "organized" or something but you are just creating a gross shape on the screen that is hard to read.
139 | - Nested navigation in UIs is a bad idea too, keep things as flat as possible.
140 | - Nesting tons of folders in your source code is also not helpful.
141 | 2. **Since we need to have more items, here's another one.**
142 | - I'm not sure if we'll bother styling more than two levels deep.
143 | - Two is already too much, three is guaranteed to be a bad idea.
144 | - If you nest four levels deep you belong in prison.
145 | 3. **Two items isn't really a list, three is good though.**
146 | - Again please don't nest lists if you want people to actually read your content.
147 | - Nobody wants to look at this.
148 | - I'm upset that we even have to bother styling this.
149 |
150 | The most annoying thing about lists in Markdown is that `
` elements aren't given a child `
` tag unless there are multiple paragraphs in the list item. That means I have to worry about styling that annoying situation too.
151 |
152 | - **For example, here's another nested list.**
153 |
154 | But this time with a second paragraph.
155 |
156 | - These list items won't have `
` tags
157 | - Because they are only one line each
158 |
159 | - **But in this second top-level list item, they will.**
160 |
161 | This is especially annoying because of the spacing on this paragraph.
162 |
163 | - As you can see here, because I've added a second line, this list item now has a `
` tag.
164 |
165 | This is the second line I'm talking about by the way.
166 |
167 | - Finally here's another list item so it's more like a list.
168 |
169 | - A closing list item, but with no nested list, because why not?
170 |
171 | And finally a sentence to close off this section.
172 |
173 | ## There are other elements we need to style
174 |
175 | I almost forgot to mention links, like [this link to the Tailwind CSS website](https://tailwindcss.com). We almost made them blue but that's so yesterday, so we went with dark gray, feels edgier.
176 |
177 | We even included table styles, check it out:
178 |
179 | | Wrestler | Origin | Finisher |
180 | | ----------------------- | ------------ | ------------------ |
181 | | Bret "The Hitman" Hart | Calgary, AB | Sharpshooter |
182 | | Stone Cold Steve Austin | Austin, TX | Stone Cold Stunner |
183 | | Randy Savage | Sarasota, FL | Elbow Drop |
184 | | Vader | Boulder, CO | Vader Bomb |
185 | | Razor Ramon | Chuluota, FL | Razor's Edge |
186 |
187 | We also need to make sure inline code looks good, like if I wanted to talk about `` elements or tell you the good news about `@tailwindcss/typography`.
188 |
189 | ### Sometimes I even use `code` in headings
190 |
191 | Even though it's probably a bad idea, and historically I've had a hard time making it look good. This _"wrap the code blocks in backticks"_ trick works pretty well though really.
192 |
193 | Another thing I've done in the past is put a `code` tag inside of a link, like if I wanted to tell you about the [`tailwindcss/docs`](https://github.com/tailwindcss/docs) repository. I don't love that there is an underline below the backticks but it is absolutely not worth the madness it would require to avoid it.
194 |
195 | #### We haven't used an `h4` yet
196 |
197 | But now we have. Please don't use `h5` or `h6` in your content, Medium only supports two heading levels for a reason, you animals. I honestly considered using a `before` pseudo-element to scream at you if you use an `h5` or `h6`.
198 |
199 | We don't style them at all out of the box because `h4` elements are already so small that they are the same size as the body copy. What are we supposed to do with an `h5`, make it _smaller_ than the body copy? No thanks.
200 |
201 | ### We still need to think about stacked headings though.
202 |
203 | #### Let's make sure we don't screw that up with `h4` elements, either.
204 |
205 | Phew, with any luck we have styled the headings above this text and they look pretty good.
206 |
207 | Let's add a closing paragraph here so things end with a decently sized block of text. I can't explain why I want things to end that way but I have to assume it's because I think things will look weird or unbalanced if there is a heading too close to the end of the document.
208 |
209 | What I've written here is probably long enough, but adding this final sentence can't hurt.
210 |
211 | ## GitHub Flavored Markdown
212 |
213 | I've also added support for GitHub Flavored Mardown using `remark-gfm`.
214 |
215 | With `remark-gfm`, we get a few extra features in our markdown. Example: autolink literals.
216 |
217 | A link like www.example.com or https://example.com would automatically be converted into an `a` tag.
218 |
219 | This works for email links too: contact@example.com.
--------------------------------------------------------------------------------
/project files/blogs/js-frameworks-comparison/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "The Power of JavaScript Frameworks: Angular vs. React vs. Vue.js"
3 | description: "Get a detailed comparison of three popular JavaScript frameworks - Angular, React, and Vue.js. Understand the strengths, weaknesses, and use cases for each framework to make an informed decision for your next web development project."
4 | image: "../../public/blogs/paul-esch-laurent-oZMUrWFHOB4-unsplash.jpg"
5 | publishedAt: "2022-11-12"
6 | updatedAt: "2022-11-12"
7 | author: "codebucks"
8 | isPublished: true
9 | tags:
10 | - javascript
11 | - web development
12 | ---
13 |
14 |
15 |
16 | Until now, trying to style an article, document, or blog post with Tailwind has been a tedious task that required a keen eye for typography and a lot of complex custom CSS.
17 |
18 | By default, Tailwind removes all of the default browser styling from paragraphs, headings, lists and more. This ends up being really useful for building application UIs because you spend less time undoing user-agent styles, but when you _really are_ just trying to style some content that came from a rich-text editor in a CMS or a markdown file, it can be surprising and unintuitive.
19 |
20 | We get lots of complaints about it actually, with people regularly asking us things like:
21 |
22 | > Why is Tailwind removing the default styles on my `h1` elements? How do I disable this? What do you mean I lose all the other base styles too?
23 | > We hear you, but we're not convinced that simply disabling our base styles is what you really want. You don't want to have to remove annoying margins every time you use a `p` element in a piece of your dashboard UI. And I doubt you really want your blog posts to use the user-agent styles either — you want them to look _awesome_, not awful.
24 |
25 | The `@tailwindcss/typography` plugin is our attempt to give you what you _actually_ want, without any of the downsides of doing something stupid like disabling our base styles.
26 |
27 | It adds a new `prose` class that you can slap on any block of vanilla HTML content and turn it into a beautiful, well-formatted document:
28 |
29 | ```html
30 |
31 |
Garlic bread with cheese: What the science tells us
32 |
33 | For years parents have espoused the health benefits of eating garlic bread
34 | with cheese to their children, with the food earning such an iconic status
35 | in our culture that kids will often dress up as warm, cheesy loaf for
36 | Halloween.
37 |
38 |
39 | But a recent study shows that the celebrated appetizer may be linked to a
40 | series of rabies cases springing up around the country.
41 |
42 |
43 | ```
44 |
45 | For more information about how to use the plugin and the features it includes, [read the documentation](https://github.com/tailwindcss/typography/blob/master/README.md).
46 |
47 | ---
48 |
49 | ## What to expect from here on out
50 |
51 | What follows from here is just a bunch of absolute nonsense I've written to dogfood the plugin itself. It includes every sensible typographic element I could think of, like **bold text**, unordered lists, ordered lists, code blocks, block quotes, _and even italics_.
52 |
53 | It's important to cover all of these use cases for a few reasons:
54 |
55 | 1. We want everything to look good out of the box.
56 | 2. Really just the first reason, that's the whole point of the plugin.
57 | 3. Here's a third pretend reason though a list with three items looks more realistic than a list with two items.
58 |
59 | Now we're going to try out another header style.
60 |
61 | ### Typography should be easy
62 |
63 | So that's a header for you — with any luck if we've done our job correctly that will look pretty reasonable.
64 |
65 | Something a wise person once told me about typography is:
66 |
67 | > Typography is pretty important if you don't want your stuff to look like trash. Make it good then it won't be bad.
68 |
69 | It's probably important that images look okay here by default as well:
70 |
71 |
78 |
79 | Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.
80 |
81 | Now I'm going to show you an example of an unordered list to make sure that looks good, too:
82 |
83 | - So here is the first item in this list.
84 | - In this example we're keeping the items short.
85 | - Later, we'll use longer, more complex list items.
86 |
87 | And that's the end of this section.
88 |
89 | ## What if we stack headings?
90 |
91 | ### We should make sure that looks good, too.
92 |
93 | Sometimes you have headings directly underneath each other. In those cases you often have to undo the top margin on the second heading because it usually looks better for the headings to be closer together than a paragraph followed by a heading should be.
94 |
95 | ### When a heading comes after a paragraph …
96 |
97 | When a heading comes after a paragraph, we need a bit more space, like I already mentioned above. Now let's see what a more complex list would look like.
98 |
99 | - **I often do this thing where list items have headings.**
100 |
101 | For some reason I think this looks cool which is unfortunate because it's pretty annoying to get the styles right.
102 |
103 | I often have two or three paragraphs in these list items, too, so the hard part is getting the spacing between the paragraphs, list item heading, and separate list items to all make sense. Pretty tough honestly, you could make a strong argument that you just shouldn't write this way.
104 |
105 | - **Since this is a list, I need at least two items.**
106 |
107 | I explained what I'm doing already in the previous list item, but a list wouldn't be a list if it only had one item, and we really want this to look realistic. That's why I've added this second list item so I actually have something to look at when writing the styles.
108 |
109 | - **It's not a bad idea to add a third item either.**
110 |
111 | I think it probably would've been fine to just use two items but three is definitely not worse, and since I seem to be having no trouble making up arbitrary things to type, I might as well include it.
112 |
113 | After this sort of list I usually have a closing statement or paragraph, because it kinda looks weird jumping right to a heading.
114 |
115 | ## Code should look okay by default.
116 |
117 | I think most people are going to use [highlight.js](https://highlightjs.org/) or [Prism](https://prismjs.com/) or something if they want to style their code blocks but it wouldn't hurt to make them look _okay_ out of the box, even with no syntax highlighting.
118 |
119 | Here's what a default `tailwind.config.js` file looks like at the time of writing:
120 |
121 | ```js
122 | module.exports = {
123 | purge: [],
124 | theme: {
125 | extend: {},
126 | },
127 | variants: {},
128 | plugins: [],
129 | }
130 | ```
131 |
132 | Hopefully that looks good enough to you.
133 |
134 | ### What about nested lists?
135 |
136 | Nested lists basically always look bad which is why editors like Medium don't even let you do it, but I guess since some of you goofballs are going to do it we have to carry the burden of at least making it work.
137 |
138 | 1. **Nested lists are rarely a good idea.**
139 | - You might feel like you are being really "organized" or something but you are just creating a gross shape on the screen that is hard to read.
140 | - Nested navigation in UIs is a bad idea too, keep things as flat as possible.
141 | - Nesting tons of folders in your source code is also not helpful.
142 | 2. **Since we need to have more items, here's another one.**
143 | - I'm not sure if we'll bother styling more than two levels deep.
144 | - Two is already too much, three is guaranteed to be a bad idea.
145 | - If you nest four levels deep you belong in prison.
146 | 3. **Two items isn't really a list, three is good though.**
147 | - Again please don't nest lists if you want people to actually read your content.
148 | - Nobody wants to look at this.
149 | - I'm upset that we even have to bother styling this.
150 |
151 | The most annoying thing about lists in Markdown is that `
` elements aren't given a child `
` tag unless there are multiple paragraphs in the list item. That means I have to worry about styling that annoying situation too.
152 |
153 | - **For example, here's another nested list.**
154 |
155 | But this time with a second paragraph.
156 |
157 | - These list items won't have `
` tags
158 | - Because they are only one line each
159 |
160 | - **But in this second top-level list item, they will.**
161 |
162 | This is especially annoying because of the spacing on this paragraph.
163 |
164 | - As you can see here, because I've added a second line, this list item now has a `
` tag.
165 |
166 | This is the second line I'm talking about by the way.
167 |
168 | - Finally here's another list item so it's more like a list.
169 |
170 | - A closing list item, but with no nested list, because why not?
171 |
172 | And finally a sentence to close off this section.
173 |
174 | ## There are other elements we need to style
175 |
176 | I almost forgot to mention links, like [this link to the Tailwind CSS website](https://tailwindcss.com). We almost made them blue but that's so yesterday, so we went with dark gray, feels edgier.
177 |
178 | We even included table styles, check it out:
179 |
180 | | Wrestler | Origin | Finisher |
181 | | ----------------------- | ------------ | ------------------ |
182 | | Bret "The Hitman" Hart | Calgary, AB | Sharpshooter |
183 | | Stone Cold Steve Austin | Austin, TX | Stone Cold Stunner |
184 | | Randy Savage | Sarasota, FL | Elbow Drop |
185 | | Vader | Boulder, CO | Vader Bomb |
186 | | Razor Ramon | Chuluota, FL | Razor's Edge |
187 |
188 | We also need to make sure inline code looks good, like if I wanted to talk about `` elements or tell you the good news about `@tailwindcss/typography`.
189 |
190 | ### Sometimes I even use `code` in headings
191 |
192 | Even though it's probably a bad idea, and historically I've had a hard time making it look good. This _"wrap the code blocks in backticks"_ trick works pretty well though really.
193 |
194 | Another thing I've done in the past is put a `code` tag inside of a link, like if I wanted to tell you about the [`tailwindcss/docs`](https://github.com/tailwindcss/docs) repository. I don't love that there is an underline below the backticks but it is absolutely not worth the madness it would require to avoid it.
195 |
196 | #### We haven't used an `h4` yet
197 |
198 | But now we have. Please don't use `h5` or `h6` in your content, Medium only supports two heading levels for a reason, you animals. I honestly considered using a `before` pseudo-element to scream at you if you use an `h5` or `h6`.
199 |
200 | We don't style them at all out of the box because `h4` elements are already so small that they are the same size as the body copy. What are we supposed to do with an `h5`, make it _smaller_ than the body copy? No thanks.
201 |
202 | ### We still need to think about stacked headings though.
203 |
204 | #### Let's make sure we don't screw that up with `h4` elements, either.
205 |
206 | Phew, with any luck we have styled the headings above this text and they look pretty good.
207 |
208 | Let's add a closing paragraph here so things end with a decently sized block of text. I can't explain why I want things to end that way but I have to assume it's because I think things will look weird or unbalanced if there is a heading too close to the end of the document.
209 |
210 | What I've written here is probably long enough, but adding this final sentence can't hurt.
211 |
212 | ## GitHub Flavored Markdown
213 |
214 | I've also added support for GitHub Flavored Mardown using `remark-gfm`.
215 |
216 | With `remark-gfm`, we get a few extra features in our markdown. Example: autolink literals.
217 |
218 | A link like www.example.com or https://example.com would automatically be converted into an `a` tag.
219 |
220 | This works for email links too: contact@example.com.
--------------------------------------------------------------------------------
/project files/blogs/mindfulness-and-meditation-techniques-for-developers-improving-focus-and-clarity/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Mindfulness and Meditation Techniques for Developers: Improving Focus and Clarity"
3 | description: "Integrating mindfulness practices helps developers cultivate present-moment awareness, fostering focus, problem-solving, and work-life balance."
4 | image: "../../public/blogs/c-d-x-PDX_a_82obo-unsplash.jpg"
5 | publishedAt: "2023-01-03"
6 | updatedAt: "2023-01-03"
7 | author: "codebucks"
8 | isPublished: true
9 | tags:
10 | - productivity
11 | ---
12 |
13 | Until now, trying to style an article, document, or blog post with Tailwind has been a tedious task that required a keen eye for typography and a lot of complex custom CSS.
14 |
15 | By default, Tailwind removes all of the default browser styling from paragraphs, headings, lists and more. This ends up being really useful for building application UIs because you spend less time undoing user-agent styles, but when you _really are_ just trying to style some content that came from a rich-text editor in a CMS or a markdown file, it can be surprising and unintuitive.
16 |
17 | We get lots of complaints about it actually, with people regularly asking us things like:
18 |
19 | > Why is Tailwind removing the default styles on my `h1` elements? How do I disable this? What do you mean I lose all the other base styles too?
20 | > We hear you, but we're not convinced that simply disabling our base styles is what you really want. You don't want to have to remove annoying margins every time you use a `p` element in a piece of your dashboard UI. And I doubt you really want your blog posts to use the user-agent styles either — you want them to look _awesome_, not awful.
21 |
22 | The `@tailwindcss/typography` plugin is our attempt to give you what you _actually_ want, without any of the downsides of doing something stupid like disabling our base styles.
23 |
24 | It adds a new `prose` class that you can slap on any block of vanilla HTML content and turn it into a beautiful, well-formatted document:
25 |
26 | ```html {1-3,4} title="index.html" caption="This is index.html file" showLineNumbers /will/
27 |
28 |
Garlic bread with cheese: What the science tells us
29 |
30 | For years parents have espoused the health benefits of eating garlic bread
31 | with cheese to their children, with the food earning such an iconic status
32 | in our culture that kids will often dress up as warm, cheesy loaf for
33 | Halloween.
34 |
35 |
36 | But a recent study shows that the celebrated appetizer may be linked to a
37 | series of rabies cases springing up around the country.
38 |
39 |
40 | ```
41 |
42 | For more information about how to use the plugin and the features it includes, [read the documentation](https://github.com/tailwindcss/typography/blob/master/README.md).
43 |
44 | ---
45 |
46 | ## What to expect from here on out
47 |
48 | What follows from here is just a bunch of absolute nonsense I've written to dogfood the plugin itself. It includes every sensible typographic element I could think of, like **bold text**, unordered lists, ordered lists, code blocks, block quotes, _and even italics_. `
This is inline code
{:html}`
49 |
50 | It's important to cover all of these use cases for a few reasons:
51 |
52 | 1. We want everything to look good out of the box.
53 | 2. Really just the first reason, that's the whole point of the plugin.
54 | 3. Here's a third pretend reason though a list with three items looks more realistic than a list with two items.
55 |
56 | Now we're going to try out another header style.
57 |
58 | ### Typography should be easy
59 |
60 | So that's a header for you — with any luck if we've done our job correctly that will look pretty reasonable.
61 |
62 | Something a wise person once told me about typography is:
63 |
64 | > Typography is pretty important if you don't want your stuff to look like trash. Make it good then it won't be bad.
65 |
66 | It's probably important that images look okay here by default as well:
67 |
68 |
75 |
76 | Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.
77 |
78 | Now I'm going to show you an example of an unordered list to make sure that looks good, too:
79 |
80 | - So here is the first item in this list.
81 | - In this example we're keeping the items short.
82 | - Later, we'll use longer, more complex list items.
83 |
84 | And that's the end of this section.
85 |
86 | ## What if we stack headings?
87 |
88 | ### We should make sure that looks good, too.
89 |
90 | Sometimes you have headings directly underneath each other. In those cases you often have to undo the top margin on the second heading because it usually looks better for the headings to be closer together than a paragraph followed by a heading should be.
91 |
92 | ### When a heading comes after a paragraph …
93 |
94 | When a heading comes after a paragraph, we need a bit more space, like I already mentioned above. Now let's see what a more complex list would look like.
95 |
96 | - **I often do this thing where list items have headings.**
97 |
98 | For some reason I think this looks cool which is unfortunate because it's pretty annoying to get the styles right.
99 |
100 | I often have two or three paragraphs in these list items, too, so the hard part is getting the spacing between the paragraphs, list item heading, and separate list items to all make sense. Pretty tough honestly, you could make a strong argument that you just shouldn't write this way.
101 |
102 | - **Since this is a list, I need at least two items.**
103 |
104 | I explained what I'm doing already in the previous list item, but a list wouldn't be a list if it only had one item, and we really want this to look realistic. That's why I've added this second list item so I actually have something to look at when writing the styles.
105 |
106 | - **It's not a bad idea to add a third item either.**
107 |
108 | I think it probably would've been fine to just use two items but three is definitely not worse, and since I seem to be having no trouble making up arbitrary things to type, I might as well include it.
109 |
110 | After this sort of list I usually have a closing statement or paragraph, because it kinda looks weird jumping right to a heading.
111 |
112 | ## Code should look okay by default.
113 |
114 | I think most people are going to use [highlight.js](https://highlightjs.org/) or [Prism](https://prismjs.com/) or something if they want to style their code blocks but it wouldn't hurt to make them look _okay_ out of the box, even with no syntax highlighting.
115 |
116 | Here's what a default `tailwind.config.js` file looks like at the time of writing:
117 |
118 | ```js
119 | module.exports = {
120 | purge: [],
121 | theme: {
122 | extend: {},
123 | },
124 | variants: {},
125 | plugins: [],
126 | }
127 | ```
128 |
129 | Hopefully that looks good enough to you.
130 |
131 | ### What about nested lists?
132 |
133 | Nested lists basically always look bad which is why editors like Medium don't even let you do it, but I guess since some of you goofballs are going to do it we have to carry the burden of at least making it work.
134 |
135 | 1. **Nested lists are rarely a good idea.**
136 | - You might feel like you are being really "organized" or something but you are just creating a gross shape on the screen that is hard to read.
137 | - Nested navigation in UIs is a bad idea too, keep things as flat as possible.
138 | - Nesting tons of folders in your source code is also not helpful.
139 | 2. **Since we need to have more items, here's another one.**
140 | - I'm not sure if we'll bother styling more than two levels deep.
141 | - Two is already too much, three is guaranteed to be a bad idea.
142 | - If you nest four levels deep you belong in prison.
143 | 3. **Two items isn't really a list, three is good though.**
144 | - Again please don't nest lists if you want people to actually read your content.
145 | - Nobody wants to look at this.
146 | - I'm upset that we even have to bother styling this.
147 |
148 | The most annoying thing about lists in Markdown is that `
` elements aren't given a child `
` tag unless there are multiple paragraphs in the list item. That means I have to worry about styling that annoying situation too.
149 |
150 | - **For example, here's another nested list.**
151 |
152 | But this time with a second paragraph.
153 |
154 | - These list items won't have `
` tags
155 | - Because they are only one line each
156 |
157 | - **But in this second top-level list item, they will.**
158 |
159 | This is especially annoying because of the spacing on this paragraph.
160 |
161 | - As you can see here, because I've added a second line, this list item now has a `
` tag.
162 |
163 | This is the second line I'm talking about by the way.
164 |
165 | - Finally here's another list item so it's more like a list.
166 |
167 | - A closing list item, but with no nested list, because why not?
168 |
169 | And finally a sentence to close off this section.
170 |
171 | ## There are other elements we need to style
172 |
173 | I almost forgot to mention links, like [this link to the Tailwind CSS website](https://tailwindcss.com). We almost made them blue but that's so yesterday, so we went with dark gray, feels edgier.
174 |
175 | We even included table styles, check it out:
176 |
177 | | Wrestler | Origin | Finisher |
178 | | ----------------------- | ------------ | ------------------ |
179 | | Bret "The Hitman" Hart | Calgary, AB | Sharpshooter |
180 | | Stone Cold Steve Austin | Austin, TX | Stone Cold Stunner |
181 | | Randy Savage | Sarasota, FL | Elbow Drop |
182 | | Vader | Boulder, CO | Vader Bomb |
183 | | Razor Ramon | Chuluota, FL | Razor's Edge |
184 |
185 | We also need to make sure inline code looks good, like if I wanted to talk about `` elements or tell you the good news about `@tailwindcss/typography`.
186 |
187 | ### Sometimes I even use `code` in headings
188 |
189 | Even though it's probably a bad idea, and historically I've had a hard time making it look good. This _"wrap the code blocks in backticks"_ trick works pretty well though really.
190 |
191 | Another thing I've done in the past is put a `code` tag inside of a link, like if I wanted to tell you about the [`tailwindcss/docs`](https://github.com/tailwindcss/docs) repository. I don't love that there is an underline below the backticks but it is absolutely not worth the madness it would require to avoid it.
192 |
193 | #### We haven't used an `h4` yet
194 |
195 | But now we have. Please don't use `h5` or `h6` in your content, Medium only supports two heading levels for a reason, you animals. I honestly considered using a `before` pseudo-element to scream at you if you use an `h5` or `h6`.
196 |
197 | We don't style them at all out of the box because `h4` elements are already so small that they are the same size as the body copy. What are we supposed to do with an `h5`, make it _smaller_ than the body copy? No thanks.
198 |
199 | ### We still need to think about stacked headings though.
200 |
201 | #### Let's make sure we don't screw that up with `h4` elements, either.
202 |
203 | Phew, with any luck we have styled the headings above this text and they look pretty good.
204 |
205 | Let's add a closing paragraph here so things end with a decently sized block of text. I can't explain why I want things to end that way but I have to assume it's because I think things will look weird or unbalanced if there is a heading too close to the end of the document.
206 |
207 | What I've written here is probably long enough, but adding this final sentence can't hurt.
208 |
209 | ## GitHub Flavored Markdown
210 |
211 | I've also added support for GitHub Flavored Mardown using `remark-gfm`.
212 |
213 | With `remark-gfm`, we get a few extra features in our markdown. Example: autolink literals.
214 |
215 | A link like www.example.com or https://example.com would automatically be converted into an `a` tag.
216 |
217 | This works for email links too: contact@example.com.
--------------------------------------------------------------------------------
/project files/Icons.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { cx } from "../utils";
3 |
4 | export const SunIcon = ({ className, ...rest }) => (
5 |
158 | );
159 |
160 | export const MoonIcon = ({ className, ...rest }) => (
161 |
336 | );
337 |
338 | export const LinkedinIcon = ({ className, ...rest }) => {
339 | return (
340 |
364 | );
365 | };
366 |
367 | export const TwitterIcon = ({ className, ...rest }) => {
368 | return (
369 |
389 | );
390 | };
391 |
392 | export const GithubIcon = ({ className, ...rest }) => {
393 | return (
394 |
409 | );
410 | };
411 |
412 | export const DribbbleIcon = ({ className, ...rest }) => {
413 | return (
414 |
438 | );
439 | };
440 |
--------------------------------------------------------------------------------