SnippetsSync

This is an extension that lets you save your global variables and snippets as files, keeping them in-sync during the development and enabling you to use version control on the files.

It should only be enabled as you develop (that is, on your dev server only, or turn it off when going in production).

How does it work?

For this to work you need to have setup “Allow Templates to be Saved as Files?” and specified a basepath in Design → Global Template Preferences. Then, start saving your snippets in a folder called “snippets” in your template directory, and your global variables in a folder called “global_variables” in your template directory. You can choose to save your snippets without a file extension, or alternatively use '.html' if you would like - global_footer.html for instance will be synced to {global_footer}.

Please note: syncing only goes from files to database, so you will need to create files for any pre-existing snippets.

Manual mode

By default the extension will just dumbly sync everything on page load. So, keep it active during development only. This shouldn’t be noticable slow – but if you want you can put SnippetsSync in "production mode" which is a setting in config/snippetssync.php. In production mode snippetssync will not sync - but have a button in the backend you can use to sync manually (you'll find this in the SnippetsSync module page)

Addon resources

Download latest release (.zip)