From 055359ece5912d48352249bc96f119813dac9184 Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Wed, 4 Nov 2026 15:48:11 -0800 Subject: [PATCH] chore(playground): load the latest published Ionic in demos for unreleased majors --- _templates/README.md | 2 ++ _templates/playground/new/demo.html.ejs.t | 7 ++-- _templates/playground/new/index.js | 40 ++++++++++++++++++++++- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/_templates/README.md b/_templates/README.md index dda6358c96d..70954f0d265 100644 --- a/_templates/README.md +++ b/_templates/README.md @@ -19,6 +19,8 @@ The CSS option will add extra files if you need to include custom CSS in your pl If you need a component for multiple versions of Ionic Framework, you (currently) need to run the generator once for each version. +If the version you pick is not published to npm yet, such as the next major on a major branch, the generated `demo.html` loads the latest published version from the CDN instead, since the CDN has nothing to serve for an unpublished version. The demo renders, but APIs new in that version do not work in it until the version is published. The generator also adds a `TODO(FW-XXXX)` comment above the CDN links. Replace `FW-XXXX` with the ticket that tracks the update, and create one if it does not exist yet. + ## Usage Once you've generated your playground, you need to add it to the main markdown file in the docs (e.g. [docs/api/button.mdx](../docs/api/button.mdx)) by doing something similar to the following example: diff --git a/_templates/playground/new/demo.html.ejs.t b/_templates/playground/new/demo.html.ejs.t index 3a6a9cadff9..62475d8262a 100644 --- a/_templates/playground/new/demo.html.ejs.t +++ b/_templates/playground/new/demo.html.ejs.t @@ -9,9 +9,10 @@ to: "<%= `static/usage/v${version}/${name}/${path}/demo.html` %>" <%= h.changeCase.titleCase(name) %> - - - <% if (css){ %> + <% if (cdnVersion !== version) { %> + <% } %> + + <% if (css){ %>