mirror of
https://github.com/jbranchaud/til
synced 2026-01-16 13:38:02 +00:00
Compare commits
2 Commits
d1f83edea7
...
daa0590684
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
daa0590684 | ||
|
|
2d10ade553 |
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
||||
|
||||
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
||||
|
||||
_1393 TILs and counting..._
|
||||
_1395 TILs and counting..._
|
||||
|
||||
---
|
||||
|
||||
@@ -194,6 +194,7 @@ _1393 TILs and counting..._
|
||||
### Docker
|
||||
|
||||
- [Configure Different Host And Container Ports](docker/configure-different-host-and-container-ports.md)
|
||||
- [Run A Basic PostgreSQL Server In Docker](docker/run-a-basic-postgresql-server-in-docker.md)
|
||||
|
||||
### Elixir
|
||||
|
||||
@@ -1235,6 +1236,7 @@ _1393 TILs and counting..._
|
||||
|
||||
### Tailwind CSS
|
||||
|
||||
- [Apply Tailwind Classes To Existing CSS Class](tailwind/apply-tailwind-classes-to-existing-css-class.md)
|
||||
- [Base Styles For Text Link](tailwind/base-styles-for-text-link.md)
|
||||
- [Specify Paths For Purging Unused CSS](tailwind/specify-paths-for-purging-unused-css.md)
|
||||
- [Use Tailwind Typography Prose In Dark Mode](tailwind/use-tailwind-typography-prose-in-dark-mode.md)
|
||||
|
||||
36
docker/run-a-basic-postgresql-server-in-docker.md
Normal file
36
docker/run-a-basic-postgresql-server-in-docker.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Run A Basic PostgreSQL Server In Docker
|
||||
|
||||
Here is a basic `docker-compose.yml` file for spinning up a Docker container
|
||||
that runs a PostgreSQL server on port 5432. This is what I use to create a
|
||||
locally-running PostgreSQL server that lives inside a docker container.
|
||||
|
||||
```yaml
|
||||
version: "3.7"
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:latest
|
||||
restart: always
|
||||
environment:
|
||||
- POSTGRES_USER=postgres
|
||||
- POSTGRES_PASSWORD=postgres
|
||||
- POSTGRES_DB=postgres
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- ./postgres-data:/var/lib/postgresql/data
|
||||
```
|
||||
|
||||
To create the docker container and start it up, run the following command from
|
||||
the same directory where you put this file:
|
||||
|
||||
```bash
|
||||
$ docker compose up
|
||||
```
|
||||
|
||||
This command knows to look for the `docker-compose.yml` file though you can
|
||||
always be explicit about the file with the `-f` option.
|
||||
|
||||
This configuration points at `postgres:latest` which currently is `16.1`. To
|
||||
run a different major version, you can change the `image` to something like
|
||||
`postgres:15`. See [Docker Hub](https://hub.docker.com/_/postgres) for more
|
||||
options.
|
||||
33
tailwind/apply-tailwind-classes-to-existing-css-class.md
Normal file
33
tailwind/apply-tailwind-classes-to-existing-css-class.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# Apply Tailwind Classes To Existing CSS Class
|
||||
|
||||
Let's say I have some HTML in my app that I don't totally control -- maybe it's
|
||||
a 3rd-party component or it was rendered by a markdown transformer. Regardless,
|
||||
I am ending up with some HTML where tags have class names that I'd like to
|
||||
style.
|
||||
|
||||
```html
|
||||
<div class="code-block">
|
||||
<!-- ... -->
|
||||
</div>
|
||||
```
|
||||
|
||||
If it was HTML (or JSX) that I was writing, I could stick whatever tailwind
|
||||
class names I wanted on the various tags to get the styling just right. But
|
||||
since I don't control it directly, I have to find another way to _apply_ those
|
||||
tailwind classes.
|
||||
|
||||
Enter [tailwind's `@apply`
|
||||
directive](https://tailwindcss.com/docs/functions-and-directives#apply). With
|
||||
this, I can target an existing class selector with any tailwind utility classes.
|
||||
Add lines like the following to your root `tailwind.css` file.
|
||||
|
||||
```css
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
/* additional styling here 👇 */
|
||||
.code-block {
|
||||
@apply bg-gray-200 rounded-md p-4;
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user