2

I consistently use a few Snippets for things like HTML HEAD boilerplate code, and I've long used the Snippet Sync add-on to give me easy file access to the snippet code.

Now that I'm consistently using Stash, I'm thinking about creating and managing Snippets wholly via Stash embeds and/or variables with type="snippet".

Curious if anyone has already made this switch / if anyone is already handling all of their snippets via Stash?

Any potential downsides in working with Snippets wholly via Stash?

1

I like to use Snippet Sync (http://devot-ee.com/add-ons/snippet-sync) on all of the sites that I work on and we do the same for the sites that we build at The Nerdery.

Using Snippet Sync allows us to save snippets as files which we've found to be much easier manage and it makes it possible to keep snippets under version control which is invaluable. It also gives us the ability to prefix our snippets which is great for code maintainability and readability. IE: snippet/global_header maps to snippets/default_site/global.group/header.html

I use Stash for template partials and caching and we've never really felt the need to do anything differently. I recommend that you check out that approach. It seems simpler and easy to manage in the long run.

I would love to hear any reasons for using Stash vs this approach.

| improve this answer | |
  • Thanks -- what you describe is what I currently do, as well. And, it certainly works well. Stash is so powerful that it seems like it can replace Snippets, which, on one hand, seems like it'd simplify some things. But, on the other hand, Stash being so powerful, using it for Snippet-like code might make things less obviously Snippet-like--which might not simplify things. Still hoping others might chime in… would be curious if @mark-croxton sees this, what he thinks. – Jay F Jan 27 '14 at 5:02
  • 1
    According to the author of this article, Snippet Sync will, "for every page load SnippetSync will, well, sync the snippets. This is not surprisingly quite intensive." – Jack Frost Mar 12 '15 at 0:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.