roots / sage

WordPress starter theme with Laravel Blade components and templates, Tailwind CSS, and a modern development workflow
https://roots.io/sage/
MIT License
12.71k stars 3.06k forks source link

Bug: Sage on windows does not map folders correct to blade templates #3118

Closed MonocodeJosePedro closed 1 year ago

MonocodeJosePedro commented 1 year ago

Terms

Description

What's wrong?

When I add a View Composer for a page blade template in a subfolder pages, it does not get mapped and does not find the variables that should be passed.

Folder structure

├── app │ ├── View │ │ ├── Components │ │ ├── Composers │ │ │ ├── pages │ │ │ │ ├── Test.php ├── resources │ ├── views │ │ ├── pages │ │ │ ├── test.blade.php

What have you tried?

Changes both folder names and namespace to be "pages" instead of "Pages".

What insights have you gained?

This seems to only be a windows issue, as it works on Linux and MacOs.

Possible solutions

Not found one yet.

Temporary workarounds

Move the View Composer to View/Composers instead of View/Composers/Pages and move the page template to views instead of views/pages

Steps To Reproduce

  1. Setup sage project with version 10.3.1 on Windows 11
  2. Add folder structure as provided and pass variable "buttonDTO".
  3. Try and dump "buttonDTO" in test.blade.php

Expected Behavior

That the template blade renders with the provided variables

Actual Behavior

image

Relevant Log Output

No response

Versions

10.3.1

retlehs commented 1 year ago
  1. WSL is a requirement to use Sage on Windows
  2. You must follow PSR-4, see https://roots.io/sage/docs/composers/

Please use Roots Discourse for further support requests