What is a Block?
A block is a self-contained piece of code (JavaScript, CSS, or both) that:- Lives at the team level, not tied to any single site
- Can be installed on multiple sites
- Maintains a single source of truth for the code
- Smooth scroll functionality
- Cookie consent banner
- Custom cursor effects
- Form validation utilities
- Animation helpers
Creating a Block
From Scratch
1
Go to Blocks
Click Blocks in the sidebar navigation.
2
Click New Block
Click the New Block button.
3
Fill in details
- Name: Descriptive name (e.g., “Smooth Scroll”)
- Description: What the block does
- Category: Organization category
4
Add your code
Write JavaScript in the JS tab and/or CSS in the CSS tab.
5
Save
Click Save to create the block.
From an Existing Script
Already have a script you want to reuse?1
Open the script
Go to your site and open the script in the editor.
2
Save as Block
Click the Save as Block button in the toolbar.
3
Name your block
Give it a name and description.
4
Done
The script is now saved as a block and available for other sites.
Installing a Block
1
Open Blocks
Go to Blocks in the sidebar.
2
Find your block
Search or browse for the block you want.
3
Click Install
Click on the block, then click Install to Site.
4
Choose the site
Select which site should receive the block.
5
Confirm
The block’s code is copied to your site as a new script.
Block vs Script
| Feature | Script | Block |
|---|---|---|
| Scope | Single site | All team sites |
| Updates | Direct editing | Re-install to update |
| Best for | Site-specific code | Reusable utilities |
Managing Blocks
Editing
Open a block and modify its code. Existing installations won’t be affected—they have their own copy.Categories
Organize blocks by category:- Animation: Motion and transitions
- Forms: Validation, submission handlers
- Navigation: Menus, scroll behavior
- Utilities: Helper functions
- Integrations: Third-party services
Tags
Add tags for better searchability:gsap,scroll,accessibility,performance
Dependencies
If your block needs external libraries:- Open the block
- Click Dependencies
- Add CDN URLs for required libraries
- These will be installed alongside the block
Sharing Blocks
Within Your Team
All blocks are automatically available to your team members.Publicly
Make a block available to all GoodCraft Script users:- Open the block
- Toggle Make Public
- The block appears in the public library
Public blocks can be installed by anyone but only you can edit them.
Best Practices
Keep blocks self-contained
Keep blocks self-contained
A good block should work without any site-specific setup. Avoid dependencies on specific class names or IDs unless documented.
Use configuration patterns
Use configuration patterns
Make blocks flexible with data attributes or options:
Document usage
Document usage
Include comments explaining how to use the block:
Handle missing elements gracefully
Handle missing elements gracefully
Don’t throw errors if expected elements don’t exist:
Version with kits for complex features
Version with kits for complex features
If a block needs setup instructions or multiple files, consider making it a Kit instead.