Skip to main content
Nintex Community Menu Bar
Question

How best to share snippets across pages?

  • July 9, 2024
  • 2 replies
  • 3 views

Forum|alt.badge.img+10

What’s the best way to share snippets across our pages? We have all of our inline Javascript in a static resource, which is nice and neat, but our snippets are currently sitting within each page as a local resource. Should we extract the snippets out to our static resource and wrap them in the registerSnippet construct?

This topic has been closed for replies.

2 replies

Forum|alt.badge.img+13

Short answer: yes 🙂 Long answer: extract the snippets into the StaticResource. Every JavaScript Resource of type “Inline (Snippet)” can be refactored into a StaticResource like this:

(function(skuid) { skuid.snippet.registerSnippet('SNIPPET_1_NAME',function(){ SNIPPET_1_BODY }); skuid.snippet.registerSnippet('SNIPPET_2_NAME',function(){ SNIPPET_2_BODY }); })(skuid); 

Forum|alt.badge.img+10
  • Author
  • 279 replies
  • July 9, 2024

Perfect. That’s just what we need. Thanks.