Creating & Using Snippets
Snippets are code that can be saved in the Edit Mode of RapidWeaver and pasted into pages with an easy drag-and-drop functionality. These codes typically include, though are not limited to, HTML, CSS, JavaScript and jQuery. The code can have functionality purposed for a relationship between it and another addon, or the code can work independently regardless of any addon. When snippets are created they are stored as files and double-clicking new snippet files will automatically install them into RapidWeaver.
1. Locating Snippets Section
Click the Snippets button (example) at the top center of RapidWeaver’s backend (where you edit page content):
This will open a pop-up menu (example) displaying any existing Snippets you have:
In this example you can see 2 snippets I have: Google Analytics code and Extra Content, which I use for one of my themes.
2. Adding Snippets
To insert this snippet I can simply drag and drop the code into any available section of my website. The section you drop the code into will at times be specific to the coding. Then drag and drop the code on your page or inside of your custom code section in the Inspector (as shown in the screenshot below).
3. Editing Snippets
In the bottom left corner of the Snippets pop-up menu you will notice 2 icons. The one shaped like a Gear will provide 3 options (example) when clicked on:
“Delete Snippet…” is self explanatory. “Edit Snippet…” re-open the menu that appears when you first create a Snippet and can be used to make changes.
“Reveal in Finder…” opens the Folder where the Snippets are saved as files. This is handy to note as you can install Snippets as files as well (simply place the file in this folder, though it must be created as the same format of course).
4. Creating Snippets
The icon next to the gear, the “+” icon, will create a pop-up menu when clicked (example):
Simply name the Snippet, though I recommend creating a name that is semantically easy to identify for later use (such as the basic function and if it is used within any particular addon).
Then insert the code in the code section. After the snippet is saved it will appear in your Snippets list and can be dragged and dropped into any available RapidWeaver sections in the backend.