Skip to content

Instantly share code, notes, and snippets.

@crock
Forked from Khaledgarbaya/postcss.config.js
Last active May 7, 2020 17:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crock/67dccc607bb3306bb257d7bc29eddd07 to your computer and use it in GitHub Desktop.
Save crock/67dccc607bb3306bb257d7bc29eddd07 to your computer and use it in GitHub Desktop.
Gatsby TailwindCSS + TUI Recipe
module.exports = {
plugins: [require("tailwindcss"), require("autoprefixer")],
}
const defaultTheme = require('tailwindcss/defaultTheme')
module.exports = {
theme: {
extend: {
fontFamily: {
sans: ['Inter var', ...defaultTheme.fontFamily.sans],
},
}
},
variants: {},
plugins: [require('@tailwindcss/ui')]
}
@import url(https://rsms.me/inter/inter.css);
@tailwind base;
@tailwind components;
@tailwind utilities;

Setup Gatsby with TailwindCSS + TailwindUI (TUI)

Tailwind CSS is a highly customizable, low-level CSS framework that gives you all of the building blocks you need to build bespoke designs without any annoying opinionated styles you have to fight to override.


Install necessary NPM packages


Install necessary Gatsby Plugins


Setup necessary Files

You are good to go

import React from "react"
import '../styles/tailwind.css'
export default () => (<h1 className="text-3xl">This is a 3xl text</h1>)
@pascalandy
Copy link

Thanks!

@pascalandy
Copy link

Question. How do you manage AlpineJS? In TUI, we have menu, tabs, KEY shortcuts, all driven by alpinejs. It's the only part i'm missing :-p

@crock
Copy link
Author

crock commented May 6, 2020

Question. How do you manage AlpineJS? In TUI, we have menu, tabs, KEY shortcuts, all driven by alpinejs. It's the only part i'm missing :-p

So this is up to you to implement the individual TUI components. This Gatsby recipe just pulls in the required dependencies and setups the tailwind config.

@pascalandy
Copy link

OK, I understand you don't need AlpineJS. Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment