Static vs src/assets in the Webpack template by Vue CLI

$ vue init webpack my-project
  • Small images are converted to data URL in base64 to avoid extra network requests.
  • Result filenames include hashes, and this way we will have the same URL as long as the content is the same. Therefore, you don’t need to worry about browsers caching their old versions.
  • You need a file with a specific name in the build output.
  • You have thousands of images and need to dynamically reference their paths.
  • Some libraries may be incompatible with Webpack and you have no other option but to include it as a <script> tag.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store