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

Static Files Not Being Served #23

Open
smazyck2 opened this issue Jan 22, 2022 · 2 comments
Open

Static Files Not Being Served #23

smazyck2 opened this issue Jan 22, 2022 · 2 comments

Comments

@smazyck2
Copy link

The Marco logo (logo.png) is not being properly served using the "fastify-static" plugin. When you start the application, the in the browser is looking for the logo at localhost:3000/logo.png which points to the root static folder at ".\static". Suffice it to say, the logo is not in that folder. Although an obvious response, would be to move the logo into the static folder, this breaks the "component-like" development pattern, and is manually intensive when there are hundreds or thousands of static images. The better resolution would be to enable the bundler to copy the static assets into another 'static folder automatically in a manner that separates each component's static assets. How can the latter be done with lasso?

@DylanPiercey
Copy link
Contributor

@smazyck2 it appears to be working for me. The reason you do not (and should not) put the asset in a static folder is that it actually is processed by vite: https://vitejs.dev/guide/assets.html#importing-asset-as-url

@smazyck2
Copy link
Author

smazyck2 commented Jan 24, 2022

To clarify - I am trying to use the "lasso-fastify" example.

I guess what I'm trying to say is that the template is not working for me when I follow the installation instructions:

npx @marko/create marko-app --template lasso-fastify
cd marko-app
npm install
npm run dev

When I try to run the web page, the image's source url is "localhost:[port]/logo.png", which does not point to the logo's file location. Are you doing something other than the instructions above to make the logo appear on the web page?

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