Replies: 11 comments 16 replies
-
@lwhiteley you can use the |
Beta Was this translation helpful? Give feedback.
-
Can you explain further how to do this while using astro cli ? in the description the command stated is pnpm exec astro --root apps/static-web dev panda cli cannot be used to run the astro project..so how do I pipe the config path to panda? I assume this can only be done using env vars or a direct in-code change..hence my suggestions. If im missing some context, let me know in further detail what you mean |
Beta Was this translation helpful? Give feedback.
-
@lwhiteley There are two steps. First you have to update the prepare script in module.exports = {
plugins: {
'@pandacss/dev/postcss': {
// Path to config
configPath: '/Users/anubra266/Dev/personal/chakra-ui/css-panda/sandbox/astro/panda.config.ts',
},
},
} Panda's postcss config accepts |
Beta Was this translation helpful? Give feedback.
-
the suggestion was helpful to understand more of how this works but unfortunately no change. i suspect postcss isnt respecting the root either and is just looking for the config file from where the command is executed. to give a better idea..the monorepo is setup like this. package.json
libs /
...
apps /
astro-project-1 /
...
panda.config.ts
postcss.config.cjs
astro-project-2 /
...
panda.config.ts
postcss.config.cjs
ive setup everything so that the main package json runs the the only issue is starting the projects now so that the correct config files are found even when starting the project from a working directory two levels up. This multi-astro project setup works fine without panda but it would be nice if i could include pandacss to improve the DX for styling if i move the panda config to the root beside the package.json then it works but this is not practical for many reasons
|
Beta Was this translation helpful? Give feedback.
-
i got even more curious to look at the code. panda is using a package // src/config.ts
var configs = [".ts", ".js", ".mts", ".mjs", ".cts", ".cjs"];
function findConfig() {
for (const config of configs) {
const result = (0, import_look_it_up.lookItUpSync)(`panda.config${config}`);
if (result) {
return result;
}
}
} it accepts an optional directory as second parameter but it is not specified, so i assume it is defaultig to |
Beta Was this translation helpful? Give feedback.
-
ive confirmed that specifying the second parameter allows astro to start properly now..i manually added it in the node_modules folder. like so // src/config.ts
var configs = [".ts", ".js", ".mts", ".mjs", ".cts", ".cjs"];
function findConfig() {
for (const config of configs) {
const result = (0, import_look_it_up.lookItUpSync)(`panda.config${config}`, '/home/lwhiteley/dev/astro-mono-repo-poc/apps/static-web');
if (result) {
return result;
}
}
} i now have another issue, the class names are generated but the css isnt injected/applied for some reason.. ive imported a main.css file with the layers |
Beta Was this translation helpful? Give feedback.
-
@lwhiteley Since your setup is complicated. You might want to use CLI instead |
Beta Was this translation helpful? Give feedback.
-
ok i figured out this part in panda config
Im new to panda but i still dont see how the suggestion to use the cli will help with astro or even allow multiple configurations to be run from a single location..rather than just providing an optional way to allow the root context to be changed like above per Astro config I also dont consider the setup complicated. i mean monorepos are not a new concept.. panda itself is built in a moorepo. apps can also be built in a monorepo.. Ive built monorepos with multiple webpack builds all using their own postcss config without issues currently im only missing one piece as mentioned here: |
Beta Was this translation helpful? Give feedback.
-
@lwhiteley I suggested the CLI way because if you're not using astro/postcss config, you can just pass the config path as a flag to all used cli commands. Happy you've got the astro way working though. What's currently missing? |
Beta Was this translation helpful? Give feedback.
-
based on the signature of if there was a way to provide a im not sure of the impact though. currently from my limited view i see three/four things that could be affected
|
Beta Was this translation helpful? Give feedback.
-
@lwhiteley Are you sure you've added the config flag to your prepare script? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I want to be able to specify the panda config location for the atro integration
Problem Statement/Justification
I am creating my astro project in a monorepo where the astro project is not at the root and there could be potentially multiple astro projects.
i want to be able to specify exactly where to find these config files for each project while executing it from the root of the monorepo.
normally i can run my astro project like this:
pnpm exec astro --root apps/static-web dev
However panda doesnt respect the
--root apps/static-web
param of astroand i get the following error:
Proposed Solution or API
Try to respect the astro
--root
param if possibleAlternatives
allow to specify
configFile
for the astro integrationfor eg.
Additional Information
im using this with an nx monorepo
Beta Was this translation helpful? Give feedback.
All reactions