1- Open the site with SharePoint Designer
2-In the ribbon go to Site Options
3-Locate the option SaveSiteAsTemplateEnabled and modify the value to true
4-Since the site template is disabled in the Publishing sites the option Save Site as Template is not available in the Site Settings you will need to navigate to the page directly: http://yourdomain.sharepoint.com/_layouts/savetmpl.aspx
5-Provide all the details and click OK after a couple of minutes you will have the WSP site template generated
Note: If you have apps downloaded from the store they could prevent you to save the site as a template if you are facing this scenario you will need to uninstall the apps first.
6-Open the Solution Gallery and click in the template name to download the wsp file containing the site template
Reference Here