Question - why static asset logo.png is in the src/assets folder instead of static folder
See original GitHub issueI was going to open an SO question for this, but this really is specific to this repo. I am only a few hours into using Vue (and so far am loving it) and was wondering if there is a reason or difference in placing assets such as images in the src
folder versus the static
folder? Most examples I have seen have thing like logo.png in the static
folder (maybe under a sub-folder). This one has logo.png in the src/assets
folder. Is there a reason behind that or does it really matter as long as it’s imported from the correct place?
AKA - does Vue or webpack treat these any based in where they are located between static or src? Just want to be sure before I shoot myself in the foot over something as simple as app structure.
Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:9
- Comments:6 (2 by maintainers)
Top Results From Across the Web
<v-img> doesn`t work with static image. [Vuetify] Image load ...
You're trying to request /assets which doesn't exist in your project, you only have /assets.img in there, so why are you requesting ...
Read more >Static vs src/assets in Vue CLI Webpack Templates
Static vs src/assets in the Webpack template by Vue CLI ... A logical question that may follow is then: Why does the static...
Read more >Images not loading from assets folder in Angular
Angular resolves this problem for you, and in a component, you have to only add a path to the assets folder, instead of...
Read more >Handling Static Assets · GitBook
logo.png" is a relative asset path and will be resolved by Webpack as a module ... component in its own directory, with its...
Read more >App Handling Assets | Quasar Framework
imageSrc: 'logo.png' } } } </script>. You can force serving static assets by binding src to a value with Vue. Instead of src="path/to/image"...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The question is actually specific to this repo and it’s addressed in that repo’s docs.
Assets processed by weback will have the same URL as long as the content is the same, also taking advantage of the browser cache. By using static, you loose the automatic hash generated by webpack in the URL and it’s more difficult to change the base URL in your code. By using webpack, you can also automatically convert small images to
data-url
in base64 to avoid small unwanted network requests thanks to theurl-loader
.tl:dr Just use webpack for your assets and put them in the
src
folder.