Proof of concept on Pantheon + Deploy on Google Cloud Platform

@403page if Iā€™m not mistaken, the approach in Pantheon is going to be changing Webpackā€™s publicPath to use a different /static folder.

Imagine you have a folder structure like this:

/var/www/html
  /wp-includes
  /wp-content
  /frontity
    /build
      /static
  ...

Then you would change the publicPath to "/frontity/build/static" and the URL of your scripts/fonts will become:

https://yourdomain.com/frontity/build/static/my-assets.some-hash.js

If the Frontity folder is instead inside wp-content, like this:

/var/www/html
  /wp-includes
  /wp-content
    /frontity
      /build
        /static
  ...

Then, then publicPath would be "/wp-content/frontity/build/static" and the URL:

https://yourdomain.com/wp-content/frontity/build/static/my-assets.some-hash.js

That way, Nginx can find the files in the file-system and everything works fine.


Our current idea is to add the ability to change the publicPath in build-time:

> npx frontity build --publicPath="/other/folder"

or in run-time, to be able to store the setting in WordPress:

https://mydomain.com/some-post/?frontity_publicPath=/other/folder

More info on the Public Path feature discussion. Feel free to give us your feedback :slight_smile:

Thanks for clarifying that @luisherranz.

Gotcha. I was struggling at first to see the workflow where youā€™d deploy /static/ to the Wordpress host and the rest of the site on the Node instance - but that helps a good deal. It would be easy enough to automate that anyway.

I think I was coming from a place of oversimplifying. Install the plugin and add the nginx rule one time on the WP instance and then deploy/update Frontity the external node.js server as normal.

The Public Path feature is definitely very interesting. Heading over to that thread nowā€¦

Well, changing the Nginx configuration is going to be always possible, and that problem doesnā€™t seem to be present on Apache. But we want to provide a method for those who donā€™t want (or donā€™t know) to change their Nginx configuration. So far, changing the publicPath seems to be the best option, although we are open to other ideas :slight_smile:

1 Like

Yeah, to echo what @luisherranz said, Iā€™d like to try a configurable publicPath before making nginx config changes. Pantheon standardize nginx config across all sites. In my R&D work right now Iā€™m sometimes going outside what our normal platform does, but ultimately I want to find a way to support Frontity that can minimize changes to our infrastructure and workflow.

2 Likes