Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Documentation for using Tailwind with Gatsby #10898

Merged
merged 4 commits into from
Jan 28, 2019

Conversation

jakedohm
Copy link
Contributor

@jakedohm jakedohm commented Jan 7, 2019

Description

I added a document with a walkthrough of how to get Tailwind CSS up and running with Gatsby via PostCSS. Based on: https://dev.to/jakedohm_34/using-tailwind-with-gatsby-js-10fj

Let me know if anything is missing, or any corrections need to be made!

@jakedohm jakedohm requested a review from a team January 7, 2019 21:33
Copy link
Contributor

@LekoArts LekoArts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments from me. I feel like CSS-in-JS should also be given some exposure as I personally use CSS-in-JS 100% of the time now and using Tailwind with the babel macro is really easy

docs/docs/tailwind-css.md Outdated Show resolved Hide resolved
docs/docs/tailwind-css.md Show resolved Hide resolved
docs/docs/tailwind-css.md Outdated Show resolved Hide resolved
plugins: [`gatsby-plugin-postcss`],
```

3. Add a PostCSS Config File
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this step be bundled with step 6? Step 6 just would tell the user to create the file with the following contents


`npm install tailwindcss --save-dev`

5. Generate Tailwind Config File
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
5. Generate Tailwind Config File
5. Generate Tailwind config file


5. Generate Tailwind Config File

To configure Tailwind, we'll need to add a Tailwind configuration file. Luckily, Tailwind has a built-in script to do this. Just run the following command:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To configure Tailwind, we'll need to add a Tailwind configuration file. Luckily, Tailwind has a built-in script to do this. Just run the following command:
To configure Tailwind, you'll need to add a Tailwind configuration file. Luckily, Tailwind has a built-in script to do this. Just run the following command:

./node_modules/.bin/tailwind init
`

6. Configure PostCSS to Use Tailwind
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
6. Configure PostCSS to Use Tailwind
6. Configure PostCSS to use Tailwind

})
```

7. Use the Tailwind Directives in Your CSS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
7. Use the Tailwind Directives in Your CSS
7. Use the Tailwind directives in your CSS


### Other resources

- [Introduction to postcss](https://www.smashingmagazine.com/2015/12/introduction-to-postcss/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [Introduction to postcss](https://www.smashingmagazine.com/2015/12/introduction-to-postcss/)
- [Introduction to PostCSS](https://www.smashingmagazine.com/2015/12/introduction-to-postcss/)

docs/docs/tailwind-css.md Show resolved Hide resolved
@LekoArts LekoArts added the type: documentation An issue or pull request for improving or updating Gatsby's documentation label Jan 8, 2019
@hagnerd
Copy link
Contributor

hagnerd commented Jan 8, 2019

Also food for thought, I would recommend adding in how to use it with PurgeCSS since Tailwind generates so much CSS and the end user likely will only use a small portion of what was generated.

LekoArts and others added 2 commits January 8, 2019 09:51
Co-Authored-By: jakedohm <jake.dohm@me.com>
Co-Authored-By: jakedohm <jake.dohm@me.com>
@jakedohm
Copy link
Contributor Author

jakedohm commented Jan 8, 2019

I think I'm going to re-structure the article like so:

Tailwind Installation & Configuration

  • Installing Tailwind
  • Adding config file

Using Tailwind

  • PostCSS
    • Installation/Usage steps
  • CSS-in-JS
    • Installation/Usage steps

Since the you have to install and configure Tailwind for both methods, I think it makes sense to only do that stuff in one place, and then show them how to implement either method. Does that sound good to you @LekoArts?

@hagnerd I'll also add instructions for how to enable PurgeCSS!

@LekoArts
Copy link
Contributor

LekoArts commented Jan 8, 2019

Yeah, sounds good!

@calcsam
Copy link
Contributor

calcsam commented Jan 25, 2019

Hey @jakedohm, wanted to check where you were on this? More and more people are asking about Gatsby and Tailwind so would be great to get this in if you're able to finish it up!

@jakedohm
Copy link
Contributor Author

@calcsam @LekoArts hi again! I've updated the docs in my latest commit to show steps for usage with both PostCSS (standard) and CSS-in-JS.

I think this should be pretty close, but feedback is welcome!

@calcsam
Copy link
Contributor

calcsam commented Jan 28, 2019

This looks great, thanks @jakedohm! I'll add a follow-up PR adding this to the docs hierarchy!

@calcsam calcsam merged commit 8c4f481 into gatsbyjs:master Jan 28, 2019
@gatsbot
Copy link

gatsbot bot commented Jan 28, 2019

Holy buckets, @jakedohm — we just merged your PR to Gatsby! 💪💜

Gatsby is built by awesome people like you. Let us say “thanks” in two ways:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. (Currently we’ve got a couple t-shirts available, plus some socks that are really razzing our berries right now.)
  2. We just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. Accept the invite by visiting https://github.com/orgs/gatsbyjs/invitation. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again!

wardpeet pushed a commit that referenced this pull request Feb 11, 2019
* Added doc for using Tailwind with Gatsby

* Add link to Tailwind

Co-Authored-By: jakedohm <jake.dohm@me.com>

* Update docs/docs/tailwind-css.md

Co-Authored-By: jakedohm <jake.dohm@me.com>

* Updating to include both PostCSS and CSS-in-JS setup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation An issue or pull request for improving or updating Gatsby's documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants