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
Fill in details
- Name: Descriptive name (e.g., “Smooth Scroll”)
- Description: What the block does
- Category: Organization category
From an Existing Script
Already have a script you want to reuse?Installing a Block
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.