Archived topic
Version control for development
3 replies · Started by Daniel on August 22, 2021
I've quickly become a fan of GP - it 'thinks the way I do' in terms of defining templates and rules for structuring the site, but it's far better than I am at generating beautiful layouts! :-) (especially combined with Generate Blocks)
I'm developing my own child themes for a couple of business site and I have code and other resources that need to go into the child theme which I maintain in a version repository (GitHub). I'm keen to continue using this approach with GP/GB but just need a little help in getting the configurations out of the database and into the file system.
I know I can manually export my GP settings into a YAML file. Is there any way that these settings can be automatically written (preferably to somewhere in the active theme) each time they are changed to (ideally as separate files per section) so I can easily include these settings in my version control process? I'm sure I'll forget to manually export these at some point :-)
(I also have a similar question re local templates and global styles for Generate Blocks - please let me know if I should I raise that separately in the GB support forum?)
Thanks in advance.
Cheers,
Daniel
Hi Daniel,
Glad you're enjoying GP!
The idea itself is do-able, but it's not something the theme does by default. You would need to develop a custom solution that hooks into something like customize_save_after that generates the necessary code.
Local Templates and Global Styles are both custom post types, so you would need a way to export the .xml files each time one of those post types were saved (save_post hook maybe?).
So, all do-able (I think), but will definitely take some custom development to get it all working.
Let me know if you have any other questions :)
Thanks for the reply Tom. I'll have to have a play with customize_save_after and save post when I get a chance ... so much to learn! :-)
In the mean time, is there a manual way to export the Local Templates and Global Styles please?
Thanks again.
Absolutely, you can export them like any post type in "Tools > Export".