Skip to main content

CDN / Local Toggle for Library Delivery

Makes your components more adaptable, faster, and privacy-ready, while keeping asset management centralized in the JCB GUI

🔄 What Is the CDN/Local Toggle?

When defining a Library in JCB, you can specify both:

  • A local fallback path (inside your component)
  • A remote CDN URL (like jsdelivr, unpkg, or a custom domain)

The toggle lets you control whether the library is loaded from:

  • A Content Delivery Network (CDN): faster for users, globally cached, reduces component size
  • A local asset file: bundled directly into your component, ideal for privacy, stability, and offline use

You choose this at build-time or even dynamically per environment if needed.

🎯 Why It Matters

  • ✅ Flexible asset sourcing
  • ✅ Easily switch from CDN to local during dev/testing
  • ✅ Supports offline builds or intranet deployments
  • ✅ Ideal for components used in privacy-conscious environments
  • ✅ CDN usage can reduce server load and improve frontend speed

You can also bind this toggle to environment flags or override it dynamically via code if needed.

🔗 Use Cases

  • Use CDN in production, local in development
  • Ship privacy-respecting components with local-only loading
  • Allow sites to use their own version of a library
  • Reduce your component size by offloading to CDNs

📦 Works With

  • Admin and Site Views
  • Templates, Layouts, Snippets
  • Component-wide or per-view scope
  • Libraries containing JS, CSS, or both

📘 Conclusion

The CDN/local toggle feature gives you fine-grained control over how your libraries are loaded — without duplicating assets or needing multiple versions. It makes your components more adaptable, faster, and privacy-ready, while keeping asset management centralized in the JCB GUI.