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

foolproof makefile #1084

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions Guide/tailwindcss.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,17 @@ form label {
We need to add a new build command for starting a tailwind build process to our `Makefile`. For that append this to the `Makefile` in your project:

```makefile
tailwind-dev:
ls tailwind/*.css|NODE_ENV=development entr npx tailwindcss build -i tailwind/app.css -o static/app.css -c tailwind/tailwind.config.js
tailwind-dev: ; ls tailwind/*.css|NODE_ENV=development entr npx tailwindcss build -i tailwind/app.css -o static/app.css -c tailwind/tailwind.config.js
```

**Make requires tab characters instead of 4 spaces in the second line. Make sure you're using a tab character when pasting this into the file**

This defines a new command `make tailwind-dev` that runs `npx tailwindcss build` whenever a CSS file inside the `tailwind/` directory changes. The CSS output will be placed at `static/app.css` (the standard main CSS file of IHP apps). It will use the tailwind configuration at `tailwind/tailwind.config.js`.

For production builds we also need a new make target:

```makefile
static/app.css:
NODE_ENV=production npm ci
NODE_ENV=production npx tailwindcss build -i tailwind/app.css -o static/app.css -c tailwind/tailwind.config.js --minify
static/app.css: ; NODE_ENV=production npm ci ; NODE_ENV=production npx tailwindcss build -i tailwind/app.css -o static/app.css -c tailwind/tailwind.config.js --minify
```

**Make requires tab characters instead of 4 spaces in the second line. Make sure you're using a tab character when pasting this into the file**

### Updating the .gitignore

As the `static/app.css` is now generated code, it's best to put the `static/app.css` into our `.gitignore` file.
Expand Down