Skip to content

Instantly share code, notes, and snippets.

@danalloway
Last active February 27, 2021 19:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danalloway/43df88939c32c69d0fb9c796737e89ba to your computer and use it in GitHub Desktop.
Save danalloway/43df88939c32c69d0fb9c796737e89ba to your computer and use it in GitHub Desktop.
Remix v0.9.x & Tailwind v2.x
/* ./styles/global.css */
@import url('https://rsms.me/inter/inter.css');
@tailwind base;
@tailwind components;
/* custom styles */
@tailwind utilities;
{
"private": true,
"name": "remix-starter-express",
"version": "1.0.0",
"scripts": {
"prebuild": "postcss styles --base styles --dir app/ --env production",
"build": "remix build",
"dev": "pm2-dev pm2.config.js",
"start": "node server.js"
},
"dependencies": {
"@remix-run/cli": "^0.9.1",
"@remix-run/data": "^0.9.1",
"@remix-run/express": "^0.9.1",
"@remix-run/react": "^0.9.1",
"compression": "^1.7.4",
"express": "^4.17.1",
"express-session": "^1.17.1",
"morgan": "^1.10.0",
"pm2": "^4.5.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-router": "^6.0.0-beta.0",
"react-router-dom": "^6.0.0-beta.0"
},
"devDependencies": {
"@tailwindcss/aspect-ratio": "^0.2.0",
"@tailwindcss/forms": "^0.2.1",
"@tailwindcss/typography": "^0.4.0",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"autoprefixer": "^10.2.1",
"postcss": "^8.2.4",
"postcss-cli": "^8.3.1",
"tailwindcss": "^2.0.2",
"typescript": "^4.1.2"
},
"engines": {
"node": "12"
}
}
module.exports = {
apps: [
{
name: "Express",
script: "server.js",
ignore_watch: ["app/**/*.css"],
watch: ["remix.config.js", "app"],
watch_options: {
followSymlinks: false,
},
env: {
NODE_ENV: "development",
},
},
{
name: "Remix",
script: "remix run",
ignore_watch: ["."],
env: {
NODE_ENV: "development",
},
},
{
name: "Styles",
script: "postcss styles --base styles --dir app/ -w",
ignore_watch: ["."],
env: {
NODE_ENV: "development",
},
},
],
};
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
const defaultTheme = require("tailwindcss/defaultTheme");
module.exports = {
purge: [
"./app/**/*.ts",
"./app/**/*.tsx",
"./app/**/*.mdx",
"./app/**/*.md",
"./remix.config.js",
],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {
fontFamily: {
sans: ["Inter var", ...defaultTheme.fontFamily.sans],
},
},
},
variants: {
extend: {},
},
plugins: [
require("@tailwindcss/forms"),
require("@tailwindcss/typography"),
require("@tailwindcss/aspect-ratio"),
],
};
@danalloway
Copy link
Author

Notes

  • install all the things you'll need:
    npm i -D tailwindcss@latest @tailwindcss/forms @tailwindcss/typography @tailwindcss/aspect-ratio postcss@latest postcss-cli@latest autoprefixer@latest
  • delete the existing app/global.css file
  • create a new global css file /styles/global.css at the root of your Remix project and make it look like what is in the GIST
  • DEV: note the addition of the Styles app in pm2.config.js
  • PROD: note the addition of the prebuild script in package.json

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