I have a Vue application that I’d like to deploy to Netlify. It currently consists of two parts:
- the Vue site itself
- a data file (
data.json
) which the Vue app reads in and is used to alter the content of the site.
The Vue site code doesn’t change very often (i.e. only if I’m updating the styles or fixing bugs), so I’d like it to deploy the “usual” way when I push new code to my git repository.
The data file changes daily. I have a bunch of Typescript files and a webpack config that build down into a generate.js
script. The output of that script would be the data.json
file.
What I was hoping to do was to use a Netlify function to run the build script and then run the generate.js script on a daily schedule. However, I’m not sure how I can then save the output of that script (i.e. the JSON data) into my site web directory in such a way that the Vue application can access it (e.g. into mysite.com/data.json
).
Any suggestions on how to handle this scenario? The only thing that seems obvious to me would be to have two applications and deploys: The Vue app would deploy to mysite.com
on repo changes, and the data site would deploy to data.mysite.com
(for example) on a schedule. The Vue app would just read the data from the external site. This doesn’t seem ideal, though.
Thanks!