Skip to main content
If two variants both need a carousel library, you do not want two copies of Splide on the page. Dev libraries fix that. Attach a library to a variant from a picker; the runtime injects the script and the CSS exactly once per page, on the pages a variant actually applies to.
Developer libraries

Developer libraries tab, registered libraries with load-time telemetry.

What is on offer

Curated for now. The catalog is worker-authoritative and each entry is pinned to a specific version with an SRI hash. Adding a library takes a small PR to the catalog. Today, examples:
  • splide@4.1.4, Splide carousel.
  • glightbox@3.3.0, GLightbox lightbox.
The current catalog is visible from the Dev libraries picker in the variation editor.

Attach one

  1. In the variation editor for a variant, open the Libraries picker.
  2. Pick a library. It gets added to the variant’s dependency list.
  3. Save. The library’s starter code is appended to your variant’s JS if the starter is more than a stub.
You can attach up to three libraries per variant.

Use it in variant JS

Inside your variant’s code, the library is available via a scoped accessor on the apply context:
  • ctx.libs.get(key) returns the library’s default export.
  • The Promise resolves once the library has finished loading on the page.
  • If you did not declare the library on the variant, the call throws UndeclaredLibraryDependencyError. Add it to the picker first.

What the runtime actually does

On the first page a variant needing library X applies to, the runtime injects a <script> (or <link>) with the pinned URL and SRI hash and waits for the load. On the second page, and for any other variant on the same page that also needs X, the library is already loaded, the picker’s second call resolves synchronously. Libraries are hosted on jsDelivr today; the target endgame is cdn.abtestly.com/lib/ which lets us pin, warm the cache, and skip a third-party origin.

Diagnostic telemetry

The picker sends a tiny telemetry beacon per library load, start, resolve, and any load errors. That is what powers the load-time column in the Libraries tab under Site → Developer libraries. No per-visitor data goes to that dataset.

Approve, deprecate, delete

Under Site → Developer libraries, workspace admins can:
  • Approve, mark a library as endorsed for the site.
  • Deprecate, mark it as “please move off”, without breaking existing variants.
  • Delete, refused (409 in_use) while any variant still references it. Detach first, then delete.

When not to reach for a library

Everything on the catalog is a proper JavaScript library. If your variant needs one line of jQuery-style behavior, write it inline. adding a library has a real byte cost that the picker cannot hide.