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

PublicDir: how to handle static assets (images) #23

Closed
knjshimi opened this issue Nov 11, 2022 · 2 comments
Closed

PublicDir: how to handle static assets (images) #23

knjshimi opened this issue Nov 11, 2022 · 2 comments

Comments

@knjshimi
Copy link

Hi guys, thanks for the work you put into this, it’s looking great!

I just wanted to know if there is a particular reason for forcing the publicdir to false, and how can I handle static assets.

As a basic example, I want to store a favicon in my repo, and my initial idea was using the vite publicdir, as it would be compiled (moved) to the shopify assets folder.

I tried to set the publicdir in vite config, but vte plugin shopify overrides it, forcing it to be ignored.

How/where can I put static images or other assets that I don’t want to be transformed, so they still are copied to the assets folder (and pushed to shopify)?

Would it be possible to add it as a plugin option, instead of forcing it?

Thanks again!

@montalvomiguelo
Copy link
Collaborator

montalvomiguelo commented Nov 13, 2022

Hey @kenji-twp,

We disable it by default because public is not part of the directory structure of a Shopify theme.

The assets in the public directory get copied to the dist directory during build only. You should be able to enable it in your vite config file using the publicDir option, then you could use rollup-plugin-copy to copy those files during dev as well.

static-assets.mp4

@knjshimi
Copy link
Author

Hey @montalvomiguelo, thanks so much for that! I was able to solve this following your instructions. I just ended up replacing rollup-plugin-copy with my own node script. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants