bencodezen / vue-enterprise-boilerplate

An ever-evolving, very opinionated architecture and dev environment for new Vue SPA projects using Vue CLI.
7.77k stars 1.32k forks source link

Why doesn't index.html go in src instead of public? #103

Closed vietquocnguyen closed 5 years ago

vietquocnguyen commented 5 years ago

I understand in the docs; it says that the contents of the public folder are automatically copied into dist, with the exception of index.html. Why shouldn't the index.html just reside in the src folder?

chrisvfritz commented 5 years ago

The index.html file is copied into the dist folder, but first undergoes a little processing. That makes the public folder the directory for all files that will always have a corresponding file with the same name in the dist directory, independently from what's in the src directory - just like index.html.

In src, the main.js file is the entry point and only files referenced from this file will ever make it into the final build. Since index.html always makes it into the final build even when it's not referenced from main.js, it doesn't belong src.

Does that make sense?

chrisvfritz commented 5 years ago

Closing due to inactivity. Happy to reopen if the question still hasn't been addressed. 🙂