[SOLVED] How to correctly load a quasar SPA from the Laravel Public Folder?
-
Hey Guys, did anyone ever try to copy the DIST folder of Quasar into the Laravel public folder?
I made a quicklaravel mix
setup:mix .copyDirectory('resources/quasarSPA/dist/js', 'public/js') .copyDirectory('resources/quasarSPA/dist/img', 'public/img') .copyDirectory('resources/quasarSPA/dist/fonts', 'public/fonts') .copyDirectory('resources/quasarSPA/dist/statics', 'public/statics') .copyDirectory('resources/quasarSPA/dist/', 'public/quasarSPA') // The only file that needed to be hand copied was the css file in the dist folder of Quasar, because it has a different name every time.
Then I set up my route and controller to return this:
public function quasarSPAView() { return \File::get(public_path() . '/quasarSPA/index.html'); }
However, when opening the laravel dev server, all quasar dist files load properly in the network tab, but nothing shows up …
Any ideas?
This is what my network tab looks like:
-
If I use the terminal to go to the laravel
public
directory, then doquasar server
orlaravel serve
and add the correct URI:/quasarSPA/index.html
then it works… but this defeats the Laravel routing functionality I think… -
The answer was:
return \File::get(public_path() . '/SPAindex.html');
can work perfectly, but you CANNOT delete Laravel’s
index.php
file inside the public folder.
that’s why you need to make sure you change the name of the index.html specially for your SPA!- Make sure you got the original index.php inside the public folder.
- If you still get a blank screen you need to:
php artisan cache:clear
andmeta+shift+R
to force a full css refresh. (this was my problem where the files would show up in network, but i’d get a blank screen)
(BTW, no need to run laravel mix for anything)