Tailwind v2 and Sage 9

I am unable to reproduce this using your instructions. It seems like either your Sage 9 install isn’t the latest or the Sage Installer update isn’t being brought in.

Now, I actually remembered that there are some easier directions I can give for using the update to Sage Installer:

$ composer create-project roots/sage my-sage-project dev-9-tailwind-2

This creates the Sage project called my-sage-project using the 9-tailwind-2 branch (which uses roots/sage-installer at 1.6.4). I will see what I can do about getting this merged + tagged soon, so that you don’t need to specify the branch.

Even using this, I still did run into an error, but I was able to resolve it. The error was that Autoprefixer expects PostCSS 8 to be directly installed (yarn add postcss --dev), so I did that and I was able to build for development (yarn build) and production (yarn build:production) using Node 12 (Tailwind 2 requires Node 12 and greater).

TL;DR: until I get a solution tagged for Sage 9, you can do the following:

# Create a new project using the Sage 9 branch that uses Sage Installer 1.6.4
$ composer create-project roots/sage my-sage-project dev-9-tailwind-2

# Make sure you are using at least Node 12.13.0
# I use Volta for this: volta pin node@12

# Bump the PostCSS dependency to 8 (how I do it here is sloppy, but this is a temporary solution)
$ yarn add postcss --dev

# Run a build to confirm it works
$ yarn build
1 Like