HansSchouten / PHPageBuilder

A drag and drop page builder to manage pages in any PHP project
https://www.phpagebuilder.com
MIT License
721 stars 177 forks source link

Folder and theme Path Locations for Serverless Applications #98

Open aw-creative opened 2 years ago

aw-creative commented 2 years ago

I am having some issues setting this up in a Laravel project running on AWS Lambda via Laravel Vapor

All works perfectly well in local development however as vapor moves most files from the public folder over to S3 to be served through CloudFront CDN the page builder theme and blocks will not load correctly.

I have moved the theme over to the resources folder then use webpack to copy it to the public folder on the build so the styles and css can be served from CloudFront. This appears to work fine for the js and css.

The issue appears to be that the page builder is unable to locate the theme files, or because they are in different places they don't load up. really unsure what the issue is here as there isn't any error reporting. it either loads up... or has an infinite spinner.

I have modified the config so allow me to inject these variables from the ENV file. and it works on local. On the staging environment, it reports the theme is in the correct location, the js and css assets are all served from the correct CloudFront CDN however I just get the infinite loading spinner.

 */
    'theme' => [
        'class' => PHPageBuilder\Theme::class,
        'folder' => base_path(env('PAGEBUILDER_THEME_PATH' , 'resources/themes/'),),
        'folder_url' => env('PAGEBUILDER_THEME_URL' , 'themes/'),
        'active_theme' => 'demo-v'
    ],

Any ideas on how to get this working on Laravel Vapor?

EDIT

Some prgoress. make sure you dsont have the layout as Master in the database, and that the case matches the filename for your layout!

Developing on windows is dumb sometimes.