formaat-design / reshaped

Community repository for storing examples, reporting issues and tracking roadmap
https://reshaped.so
97 stars 3 forks source link

Using new viewports in theme generations does nothing #270

Open TimCrooker opened 2 days ago

TimCrooker commented 2 days ago

Describe the bug I created a new theme and ran the CLI and the breakpoints are still the same as before adding the new breakpoints

Expected behavior Updating the breakpoints in the selected theme should then use those breakpoints throughout the application wherever applicable

Screenshots Screenshot 2024-06-29 at 4 12 59 PM

Screenshot 2024-06-29 at 4 13 22 PM

Environment (please complete the following information):

blvdmitry commented 2 days ago

This happens due to how custom media queries plugin works in postcss. Since breakpoints can't be resolved in runtime and are defined during the build process, you have to pass a path to the theme defining your theme media queries values when creating postcss config: https://reshaped.so/docs/getting-started/react/installation#installation

It seems like this piece can be mentioned in a few other places too, so I'll add similar information to the theming section

blvdmitry commented 2 days ago

Sorry, I meant this part. Do you use the getConfig function in your postcss config?

const path = require("path");
const { getConfig } = require("reshaped/config/postcss");

module.exports = getConfig({
  themeMediaCSSPath: path.resolve(__dirname, "src/themes/my-theme/media.css"),
});
TimCrooker commented 2 days ago

No you're right I misread your comment on my phone. I didn't see that part of the docs. I recommend you add it in the customizing your theme documentation where it references modifying breakpoints. Thanks for the help!

blvdmitry commented 2 days ago

Will do, thanks!