FLBuilderCSS Class
TheFLBuilderCSS class (class-fl-builder-css.php) provides a powerful API for generating CSS rules with responsive breakpoint support.
Basic CSS Rules
Add CSS rules using therule() method:
Responsive Rules
From class-fl-builder-css.php:83-199, responsive rules automatically generate CSS for all breakpoints:Breakpoints
From class-fl-builder-css.php:16:Compound Field Rules
For complex fields like typography, border, and dimension:Typography Field Rule
Typography Field Rule
From class-fl-builder-css.php:367-434:This automatically generates CSS for:
- Font family and weight
- Font size with units
- Line height
- Letter spacing
- Text alignment
- Text transform
- Text decoration
- Font style and variant
- Text shadow
Border Field Rule
Border Field Rule
From class-fl-builder-css.php:309-358:Generates:
- Border style, color, and width (per side)
- Border radius (per corner)
- Box shadow
Dimension Field Rule
Dimension Field Rule
From class-fl-builder-css.php:208-239:
Rendering CSS
After adding rules, render them:- Groups rules by breakpoint
- Combines rules with the same selector
- Outputs CSS wrapped in media queries
- Resets the rules array
Module CSS Generation
Modules generate CSS in their PHP files using thecss method pattern:
my-module/css.php:
Auto CSS System
From class-fl-builder-css.php:670-919, Beaver Builder can automatically generate CSS from field preview configurations:Asset Management
From class-fl-builder-model.php (lines 992-1046), asset management handles caching and versioning.Asset Info
Get asset paths and URLs:Asset Versioning
From class-fl-builder-model.php:992-1002:Enqueue Methods
From class-fl-builder-model.php:1057-1064:- File Method (Default)
- Inline Method
Assets are saved to cache files and enqueued:
- Better for production
- Utilizes browser caching
- Reduces page size
Cache Management
Delete asset cache when needed:Module JavaScript
Modules can include custom JavaScript by creatingjs/frontend.js:
Enqueuing Assets
For custom module assets:Cache Directory
From class-fl-builder-model.php:951-981:wp-content/uploads/bb-plugin/cache/
Best Practices
Use Responsive Rules
Use
responsive_rule() instead of manual breakpoint CSS for consistency.Leverage Auto CSS
Enable auto CSS in field preview configs to reduce manual CSS code.
Cache Smartly
Clear cache only when necessary to maintain performance.
Namespace Selectors
Always prefix selectors with
.fl-node-$id for specificity.Performance Tips
Use Compound Fields
Use built-in compound field rules (typography, border) instead of individual rules.
Related Resources
Custom Fields
Learn about field types and preview system
AJAX Operations
Handle AJAX rendering and refreshes
Data Model
Understand layout data structure
Module Development
Create custom modules with assets