gregwolanski / eleventy-tailwindcss-alpinejs-starter

As little code as possible. Learn more: https://css-tricks.com/eleventy-starter-with-tailwind-css-alpine-js/
MIT License
233 stars 39 forks source link

style.css doesnt get compiled on npm run start #11

Open ineptian opened 2 years ago

ineptian commented 2 years ago

On windows and have the cross env stuff setup.

When running npm run start there are no errors, but the style.css doesn't end up in the _site folder.

The build works fine.

ChrisArchitect commented 2 years ago

Hi there

Coincidentally I was just playing around with this and after seeing no errors but also no effects of Tailwindcss being deployed -- wasted an hour scratching head before realizing this doesn't work on Windows! Saw similar comments on some other tailwind/11ty starters around the net that weren't doing it the way this one does with the '&' to concatenate the npx builds together.

One way to get this to work is edit package.json to:

{
  "scripts": {
    "dev:eleventy": "npx eleventy --serve",
    "dev:tailwind": "npx tailwindcss -i styles/tailwind.css -c styles/tailwind.config.js -o _site/style.css --watch",
    "build:eleventy": "ELEVENTY_PRODUCTION=true eleventy",
    "build:tailwind": "npx tailwindcss -i styles/tailwind.css -c styles/tailwind.config.js -o _site/style.css --minify",
    "build": "NODE_ENV=production npm-run-all build:tailwind build:eleventy",
    "start": "npm-run-all --parallel dev:*"
  },
  "devDependencies": {
    "@11ty/eleventy": "^1.0.0",
    "alpinejs": "^3.7.0",
    "html-minifier": "^4.0.0",
    "npm-run-all": "^4.1.5",
    "tailwindcss": "^3.0.0"
  }
}

Run npm install after making these edits.

Hope that helps or at least points you in the right direction and saves some hassle! Was surprised this didn't account for Windows devs or whatever, maybe an update to the css-tricks article would be in order.