Skip to content

Harvey-AU/webflow-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

76 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

License: MIT GitHub last commit

Harvey Webflow Framework

A CSS and JavaScript framework designed for Webflow projects using the Harvey Component Library. This framework provides reusable components, utilities, and styling systems.

πŸš€ Quick Start

Netlify Status

Add this single line to your Webflow project's custom code (<head> section):

<!-- Production (recommended): Minified with Lightning CSS, ~198KB -->
<link rel="stylesheet" href="https://webflow.teamharvey.co/css/main.css" />

<!-- Stable versioned snapshot (pin to specific build): -->
<link rel="stylesheet" href="https://webflow.teamharvey.co/v/2025-11-13/v1/css/main.css" />

Optional: Add JavaScript functionality before closing </body> tag:

<script src="https://webflow.teamharvey.co/js/main.js"></script>

Optional: Add filter tracking (loads separately):

<script src="https://webflow.teamharvey.co/js/filter-tracking.js"></script>

πŸ“ Project Structure

webflow-framework/
β”œβ”€β”€ src/                            # Source files (private)
β”‚   └── css/
β”‚       β”œβ”€β”€ imports.css             # Build input file (defines import order)
β”‚       β”œβ”€β”€ core/                   # Core framework components
β”‚       β”‚   β”œβ”€β”€ base.css
β”‚       β”‚   β”œβ”€β”€ buttons.css
β”‚       β”‚   β”œβ”€β”€ corners.css
β”‚       β”‚   β”œβ”€β”€ fluid-sizing.css
β”‚       β”‚   β”œβ”€β”€ gap.css
β”‚       β”‚   β”œβ”€β”€ grid.css
β”‚       β”‚   β”œβ”€β”€ max-lines.css
β”‚       β”‚   └── richtext-extras.css
β”‚       β”œβ”€β”€ framework-mapping/      # CSS variable mappings
β”‚       β”‚   β”œβ”€β”€ colour/
β”‚       β”‚   β”‚   β”œβ”€β”€ primitive.css
β”‚       β”‚   β”‚   β”œβ”€β”€ semantic.css
β”‚       β”‚   β”‚   └── semantic-buttons.css
β”‚       β”‚   β”œβ”€β”€ fonts/
β”‚       β”‚   β”‚   β”œβ”€β”€ base.css
β”‚       β”‚   β”‚   └── rich-text.css
β”‚       β”‚   β”œβ”€β”€ sizing/
β”‚       β”‚   β”‚   β”œβ”€β”€ border-corner.css
β”‚       β”‚   β”‚   β”œβ”€β”€ button.css
β”‚       β”‚   β”‚   β”œβ”€β”€ gap-spacing.css
β”‚       β”‚   β”‚   └── general.css
β”‚       β”‚   └── framework.css
β”‚       └── icons/                  # Icon system
β”‚           β”œβ”€β”€ base.css
β”‚           β”œβ”€β”€ content.css
β”‚           β”œβ”€β”€ mapping.css
β”‚           └── simple.css
β”œβ”€β”€ dist/                           # Built files (public)
β”‚   β”œβ”€β”€ css/
β”‚   β”‚   β”œβ”€β”€ main.css                # Production version (198KB, minified)
β”‚   β”‚   β”œβ”€β”€ main.2025-11-13-v1.css  # Version-tagged for long-term caching
β”‚   β”‚   └── main.unminified.css     # Debug version (226KB, unminified)
β”‚   β”œβ”€β”€ js/                         # JavaScript functionality
β”‚   β”‚   β”œβ”€β”€ main.js                 # Main JS loader
β”‚   β”‚   β”œβ”€β”€ main.2025-11-13-v1.js   # Version-tagged for long-term caching
β”‚   β”‚   β”œβ”€β”€ external-links.js       # Auto-handle external links
β”‚   β”‚   β”œβ”€β”€ insert-data.js          # Data insertion utilities
β”‚   β”‚   β”œβ”€β”€ query-param-to-form.js  # URL params to form fields
β”‚   β”‚   β”œβ”€β”€ social-share.js         # Social sharing functionality
β”‚   β”‚   β”œβ”€β”€ tooltip.js              # Interactive tooltips
β”‚   β”‚   └── filter-tracking.js      # Optional: filter analytics (not auto-loaded)
β”‚   β”œβ”€β”€ _redirects                  # Netlify redirects for cache busting
β”‚   β”œβ”€β”€ _headers                    # Cache-Control headers for optimal performance
β”‚   └── v/                          # Versioned snapshots (ignored in git)
β”‚       β”œβ”€β”€ 2025-10-01/
β”‚       β”‚   └── v1/                 # First build of the day
β”‚       β”‚       β”œβ”€β”€ css/
β”‚       β”‚       └── js/
β”‚       └── 2025-10-02/
β”‚           β”œβ”€β”€ v1/                 # Versioned builds
β”‚           β”œβ”€β”€ v2/
β”‚           └── v3/
β”œβ”€β”€ build.js                        # Build script (Lightning CSS)
β”œβ”€β”€ netlify.toml                    # Deployment configuration
└── README.md

🎯 Features

Core Components

  • Base Styles: Foundation styling and resets
  • Grid System: Flexible grid layouts
  • Buttons: Comprehensive button styling system
  • Fluid Sizing: Responsive sizing utilities
  • Gap & Spacing: Consistent spacing system
  • Corners: Border radius utilities
  • Text Controls: Multi-line text truncation

Framework Mapping

  • Color System: Primitive and semantic color tokens
  • Typography: Base fonts and rich text styling
  • Sizing System: Consistent sizing scales
  • Button Variants: Semantic button styles

Icon System

  • Base Icons: Core icon styling
  • Content Icons: Content-specific icons
  • Icon Mapping: Icon utility classes

JavaScript Features

  • External Links: Automatically opens external links in new tabs with proper security attributes
  • Tooltip System: Interactive tooltips for enhanced UX
  • Social Sharing: One-click social media sharing functionality
  • Form Utilities: Automatically populate form fields from URL query parameters
  • Smart Loading: Main.js automatically loads all modules with error handling

πŸ”„ Versioning & Caching System

The framework uses an intelligent caching strategy for optimal performance:

Latest (always current):

<!-- Stable URL that redirects to the latest version-tagged file -->
<link rel="stylesheet" href="https://webflow.teamharvey.co/css/main.css" />
<script src="https://webflow.teamharvey.co/js/main.js"></script>

Stable versioned snapshots (pin to specific build):

<!-- Pin to specific date and version for guaranteed stability -->
<link rel="stylesheet" href="https://webflow.teamharvey.co/v/2025-11-13/v1/css/main.css" />
<script src="https://webflow.teamharvey.co/v/2025-11-13/v1/js/main.js"></script>

How it works:

Cache Performance Strategy:

  1. Stable URLs (/css/main.css, /js/*.js) β†’ 302 redirect to version-tagged files
    • Cache-Control: public, max-age=0, must-revalidate (always fresh)
  2. Version-tagged files (main.2025-11-13-v1.css) β†’ Immutable, cached for 1 year
    • Cache-Control: public, max-age=31536000, immutable
  3. Result: Browsers cache assets long-term while stable URLs stay fresh

Versioning:

  • Each deployment creates a new dated snapshot in /v/{YYYY-MM-DD}/v{N}/
  • Multiple builds per day get incremental versions (v1, v2, v3...)
  • All previous versions remain available permanently
  • Format: v/{YYYY-MM-DD}/v{N}/css/main.css

When to use each approach:

  • βœ… Latest URL - Development, always get newest features with browser caching
  • βœ… Versioned snapshots - Production projects, client sites, guaranteed stability
  • βœ… Staging environments - Test new versions before pinning to production

πŸš€ Performance

Before optimization:

  • 18 sequential HTTP requests via @import statements
  • ~220KB total download across multiple files
  • Render-blocking CSS loading waterfall
  • No browser caching (always re-downloaded)

After optimization:

  • 1 HTTP request (single concatenated file)
  • 198KB minified with Lightning CSS (12% reduction)
  • Eliminates render-blocking import chain
  • Long-term browser caching via version-tagged files (1-year immutable cache)
  • Stable URLs automatically redirect to latest cached version
  • Significant improvement on mobile, slower connections, and repeat visits

πŸ“– Usage

Basic Implementation

  1. Add the CSS framework to your Webflow project (<head>):

    <link rel="stylesheet" href="https://webflow.teamharvey.co/css/main.css" />
  2. Add JavaScript functionality (before </body>):

    <script src="https://webflow.teamharvey.co/js/main.js"></script>

Individual Components

If you only need specific components, you can import them individually:

CSS Components:

<!-- Just the button system -->
<link rel="stylesheet" href="https://webflow.teamharvey.co/css/core/buttons.css" />

<!-- Just the grid system -->
<link rel="stylesheet" href="https://webflow.teamharvey.co/css/core/grid.css" />

JavaScript Modules:

<!-- Just external links functionality -->
<script src="https://webflow.teamharvey.co/js/external-links.js"></script>

<!-- Just tooltip functionality -->
<script src="https://webflow.teamharvey.co/js/tooltip.js"></script>

JavaScript Framework Events

The framework dispatches a custom event when all modules are loaded:

<script>
  document.addEventListener("webflowFrameworkReady", function (e) {
    console.log("πŸŽ‰ Framework ready!", e.detail);
    // Your custom code here
  });
</script>

Debug Information

Enable debug logging by adding ?debug to your URL:

Visit: https://yoursite.com/?debug

When debug mode is active, you'll see structured logs in the console:

[Framework][Initialisation] Loading JavaScript modules...
[Framework][Module Load] Loaded tooltip.js
[Tooltip][Initialisation] Container element with id 'tooltip-container' not found

Access framework debug information in the browser console:

// Check if debug mode is active
console.log(window.WebflowFramework.isDebugMode);

// Check what modules are loaded
console.log(window.WebflowFramework.modules);

// Manually trigger debug logging (only works when ?debug is in URL)
window.WebflowFramework.debug("My Feature", "Test", "Custom debug message");

// Manually reload all JavaScript modules
window.WebflowFramework.reload();

πŸ”§ Development

Making Changes

  1. Clone the repository:

    git clone https://github.com/Harvey-AU/webflow-framework.git
  2. Install dependencies:

    npm install
  3. Edit source files:

    • CSS: Edit files in src/css/ subfolders
    • JS: Edit files directly in dist/js/ (no build needed)
    • Add new CSS files: Update src/css/imports.css import order
  4. Test build locally:

    node build.js
  5. Commit and push changes:

    git add .
    git commit -m "Update button styles"
    git push origin main
  6. Automatic deployment:

    • Netlify builds and deploys within 1-2 minutes
    • Creates new versioned snapshot automatically
    • Both latest and versioned URLs updated

Build Process

The framework uses Lightning CSS for optimal performance:

  1. Reads src/css/imports.css to understand import order
  2. Concatenates all imported CSS files into single files
  3. Minifies using Lightning CSS (Rust-based, fastest available)
  4. Outputs both debug and production versions
  5. Creates automatic versioned snapshots

Build outputs:

  • dist/css/main.css - Production version (198KB, Lightning CSS minified)
  • dist/css/main.{version-tag}.css - Version-tagged file for long-term caching
  • dist/css/main.unminified.css - Debug version (226KB, unminified)
  • dist/js/*.js - Original JS files (stable URLs)
  • dist/js/*.{version-tag}.js - Version-tagged JS files for long-term caching
  • dist/_redirects - Netlify 302 redirects from stable URLs to version-tagged files
  • dist/_headers - Cache-Control headers for optimal caching strategy
  • dist/v/{date}/v{n}/ - Versioned snapshots for backwards compatibility

Build files:

  • src/css/imports.css - Source file defining import order
  • build.js - Build script using Lightning CSS
  • netlify.toml - Deployment configuration (publish = "dist")
  • package.json - Lightning CSS and esbuild dependencies

Load Order

The framework loads components in this order:

  1. Core base styles
  2. Framework mapping (colors, fonts, sizing)
  3. Core components
  4. Icons
  5. Library backend styles

JavaScript modules are loaded asynchronously in parallel for optimal performance.

Adding New JavaScript Modules

To add a new JavaScript module to the framework:

  1. Create your .js file in the /js/ directory
  2. Add the filename to the JS_MODULES array in main.js
  3. Commit and push - the module will be automatically loaded

🌐 CDN Information

This framework is hosted via Netlify for optimal performance and reliability.

  • Base URL: https://webflow.teamharvey.co/
  • Update Time: 1-2 minutes after pushing changes
  • Caching Strategy:
    • Stable URLs β†’ 302 redirect (always revalidate)
    • Version-tagged files β†’ Immutable, 1-year cache
    • Optimal for both development and production use
  • Reliability: Backed by Netlify's global CDN infrastructure
  • Performance: Long-term browser caching eliminates redundant downloads

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/new-component)
  3. Make your changes
  4. Test in a Webflow project
  5. Commit changes (git commit -m 'Add new component')
  6. Push to branch (git push origin feature/new-component)
  7. Open a Pull Request

πŸ“ File Naming Convention

  • Use kebab-case for all file names
  • Organise by functionality/category
  • Keep individual files focused on single components
  • Use descriptive names (e.g., semantic-buttons.css not buttons2.css)

πŸ“‹ Roadmap

  • Add animation utilities
  • Expand icon system
  • Add dark mode support
  • Create component documentation

πŸ“„ License

MIT License - feel free to use in any project, but only really works with the Harvey Component library.

πŸ› Issues & Support

Found a bug or need a feature? Open an issue on GitHub.


Made with ❀️ for the Webflow community

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •