postcss / postcss-cli

CLI for postcss
Other
824 stars 93 forks source link

Monorepo with yarn workspaces. Output relative to file and not cwd #390

Closed PetterRuud closed 2 years ago

PetterRuud commented 2 years ago

I have a folder packageswith different packages.

packages
│
└───folder1
│   └───src
│       │   style.css
│       │   ...
└───folder2
│   └───src
│       │   style.css
│       │   ...

I run this command in each package now with lerna

"build:css": "postcss src/style.css --dir dist --map"

This works fine, but I want to run one command so I dont need to run it for each package I have tried several different --dir and --basevariants.

"build:css": "postcss \"packages/**/src/style.css\" --dir dist --base --map",

Wanted output

packages
│
└───folder1
│   └───src
│       │   style.css
│       │   ...
│   └───dist
│       │   style.css
└───folder2
│   └───src
│       │   style.css
│       │   ...
│   └───dist
│       │   style.css

Any suggestion are much appreciated

RyanZim commented 2 years ago

Unfortunately, postcss-cli doesn't support any flags to do what you're describing in a single command. You're probably best off with a custom script that loops through each package directory and runs the command there.