In a Laravel-Inertia-Vue application, there is no technical requirement from Inertia.js, Vue, or Laravel that mandates route page files (such as Index.vue, Create.vue, Show.vue) be capitalized. The capitalization you often see is due to convention, aiming for consistency and readability, and mirroring Vue component naming best practices.
Key Considerations:
-
File System Case Sensitivity
- Linux systems are case-sensitive, while Windows and macOS (by default) are not. This can cause deployment issues if you change only the casing and rely on Git to notice the change.
- Example: renaming
index.vuetoIndex.vuemight not be reflected in Git on Windows, but will matter on Linux.
-
Routing Conventions
- Some frameworks, such as Nuxt or Vite’s file-based routing, expect route/page files to be lowercase (e.g.,
index.vue,about.vue). Capitals can cause those routers to skip your files or break your routes. - Inertia itself does not enforce any naming convention, so you are safe to use lowercase if it suits your broader goals (such as code reuse between projects).
- Some frameworks, such as Nuxt or Vite’s file-based routing, expect route/page files to be lowercase (e.g.,
-
Component Naming in Vue
- Vue's convention is for components to be PascalCase (
MyComponent.vue). However, this is not mandatory for pages unless you specifically need to reference them as components somewhere else.
- Vue's convention is for components to be PascalCase (
-
Code Portability
- If your goal is to maximize portability and compatibility with static file routers or frameworks (like Nuxt), all-lowercase for route files is safer.
- For code consistency, try to pick one convention and stick with it throughout your projects.
Downsides to Not Capitalizing:
- There are no downsides within a Laravel-Inertia-Vue context. The framework does not care about capitalization for page file names.
- Some minor confusion may arise if you mix conventions (lowercase for pages, PascalCase for components), but it does not impact functionality.
What to Watch Out For:
- If you start a project with capitalized names and later change them to lowercase, ensure you use
git mvto rename files so that git tracks the casing change properly:git mv Index.vue index.vue - Be aware of import paths elsewhere in your code that might break if the case changes.
Summary: You are perfectly safe to use lowercase for your route/page files in Laravel-Inertia-Vue. In fact, this may avoid deployment and cross-platform issues. There is no functional downside to this approach in the context of Inertia.js and Laravel.
Recommendation:
For maximal compatibility and fewer surprises, especially if you share codebases or switch between routers/apps, stick to lowercased filenames for your page components.
Example Folder Structure:
resources/js/Pages/
index.vue
create.vue
show.vue
Other Opinions:
Some teams prefer capitalizing page components for visual distinction in editors, but this is strictly a style choice.
Conclusion:
Use whichever convention best fits your workflow and environment, but lowercase page filenames are safer for cross-platform compatibility and integration with file-based routers. There are no functional downsides to this approach in Laravel-Inertia-Vue.