Tailwind CSS v4
FreshJuice DEV uses the latest Tailwind CSS v4, which includes significant improvements:- Zero-config setup with automatic file scanning
- Native CSS variables and custom properties
- Enhanced performance and smaller bundle sizes
- New design tokens system
CSS Architecture
The theme’s CSS is organized into multiple layers:Tailwind Configuration
The main configuration is insource/css/tailwind.css:
source/css/tailwind.css
Using Tailwind Classes
Layout and spacing
Use Tailwind’s layout utilities for structure:Common layout classes:
container- Centers content with max-widthmx-auto- Centers horizontallypx-4,py-8- Padding (x-axis, y-axis)grid,flex- Layout systemsgap-6- Grid/flex gap spacing
Typography
Apply text styles with utility classes:Typography utilities:
text-{size}- Font size (sm, base, lg, xl, 2xl, etc.)font-{weight}- Weight (light, normal, medium, semibold, bold)tracking-{spacing}- Letter spacingleading-{height}- Line height
Colors
Use the theme’s color palette:Custom colors:
cursor- White (#FFFFFF)terminal- Black (#000000)
Custom Theme Variables
FreshJuice DEV includes custom CSS variables you can use:Custom Colors
Custom Fonts
Aspect Ratios
Use custom aspect ratio utilities:Prose Styling
For rich text content, use Tailwind’s typography plugin:prose-sm- Smaller textprose-lg- Larger textprose-xl- Extra large textmax-w-full- Override max-width constraint
Component Examples
Card Component
Button Styles
Grid Layouts
Form Elements
Base form styles are insource/css/base/forms.css:
Using Theme Fields
Access global theme settings in your modules:Learn more about using theme fields in the Theme Fields Guide.
Custom Utilities
Add custom utilities insource/css/utilities/utils.css:
Animations
Custom animations are defined insource/css/base/animations.css:
Dark Mode Support
Implement dark mode with Tailwind’s dark variant:Performance Tips
Purge Unused Styles
Tailwind v4 automatically purges unused styles. Ensure all your templates are in the
@source paths.Avoid Custom CSS
Use Tailwind utilities whenever possible. Custom CSS increases bundle size and maintenance complexity.
Use JIT Mode
Tailwind v4 uses JIT by default, generating styles on-demand for faster builds.
Optimize Images
Use responsive images with Tailwind’s aspect ratio utilities for better performance.
Best Practices
- Mobile-First Design - Apply base styles for mobile, then add responsive modifiers
- Consistent Spacing - Use the spacing scale (4, 8, 16, 24, 32, etc.)
- Semantic Classes - Group related utilities together for readability
- Component Extraction - For repeated patterns, consider creating reusable modules
- Accessibility - Include focus states and ARIA attributes
Next Steps
Creating Modules
Learn how to create custom HubSpot modules
Adding JavaScript
Add interactive functionality to your components
Theme Fields
Customize global theme settings
Tailwind Docs
Official Tailwind CSS documentation