Skip to content

kaiserrrrrr/cherry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🍒 Cherry

A native, zero-config optimization engine for the modern web.

Cherry.js is a "healing" library designed to bridge the gap between semantic design and technical performance. It identifies common accessibility gaps, SEO omissions, and performance bottlenecks (like Cumulative Layout Shift) and patches them at runtime during browser idle periods.


🌟 Why Cherry?

Most performance tools only report errors; Cherry fixes them. Built on the principle of "In-Flight Repair", it offers:

  • Zero Technical Debt: Patches legacy HTML for WCAG and SEO compliance without changing a line of source code.
  • Idle-Time Execution: Utilizes requestIdleCallback to perform DOM surgery only when the browser is idle, protecting your Total Blocking Time (TBT).
  • Aesthetic Preservation: Allows designers to focus on the visual layer while the engine handles the technical enforcement underneath.

🚀 Installation

CDN (recommended):

  1. Simply add this in your <head> tag:

    <script src="https://cdn.jsdelivr.net/gh/kaiserrrrrr/cherry/src/cherry.min.js" async></script>

Manually:

  1. Download the file:

    wget "https://cdn.jsdelivr.net/gh/kaiserrrrrr/cherry/src/cherry.min.js"

    OR download directly: cherry

  2. Link it from HTML:

    <script src="cherry.min.js" async></script>

❓ How it works

sequenceDiagram
    autonumber
    participant B as Browser
    participant C as Cherry.js
    participant D as DOM (Web Page)

    Note over B, D: Script Initialization
    
    B->>C: Load script
    activate C
    alt if readyState is 'complete'
        C->>C: init()
    else wait for 'load' event
        B-->>C: window.onload
        C->>C: init()
    end
    deactivate C

    Note over C, D: Performance
    activate C
    C->>D: Set loading="lazy" (img/iframe)
    C->>D: Set width/height from naturalWidth
    C->>B: Force {passive: true} on listeners
    C->>D: Append font preconnect links
    deactivate C

    Note over C, D: Accessibility
    activate C
    C->>D: Remove body[aria-hidden]
    C->>D: Fix input Labels & unique IDs
    C->>D: Ensure alt="" and aria-labels exist
    C->>D: Set min-size (44px) for tap targets
    deactivate C

    Note over C, D: Best Practices
    activate C
    C->>D: Add [rel="noopener"] to _blank links
    C->>D: Reset tabindex > 0 to 0
    C->>B: Stop paste event propagation
    C->>D: Remove <meta http-equiv="refresh">
    deactivate C

    Note over C, D: SEO
    activate C
    C->>D: Set html[lang] & charset="UTF-8"
    C->>D: Generate Description & Robots meta
    C->>D: Enforce viewport max-scale=5
    C->>D: Inject hidden H1 & fix list nesting
    deactivate C

    Note over B, D: Page Optimization Complete
Loading

🎨 Built for Blossom

Cherry.js is the definitive technical companion for Blossom.css. While Blossom provides the visual framework and semantic baseline, Cherry handles the technical enforcement:

  • Layout Stability: Respects Blossom's centering logic (max-width and margin: auto) while preventing layout jumps.
  • Theme Native: Injected UI elements automatically inherit Blossom’s CSS variables (--bg-color, --text-color, --btn-bg).
  • Responsive Dark Mode: Fully compatible with Blossom’s native @media (prefers-color-scheme: dark) root variables.

🌐 Browsers supported

Edge
Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
iOS Safari
iOS Safari
Samsung
Samsung
Opera
Opera
Edge Last 68 versions Last 65 versions Last 6 versions Last 6 versions Last 16 versions Last 60 versions

📜 License

© Cherry 2026. Code released under the GNU General Public License v3.0.


Built with 🍒 and Blossom.

Releases

No releases published

Packages

 
 
 

Contributors