Skip to content

Commit

Permalink
DA Live Preview
Browse files Browse the repository at this point in the history
Add live preview support for Document Authoring for customers who use the new Commerce Scaffold CLI.

## Note:
If there is no query param, the script will not be imported. Either way, this runs after loadPage and does not impact performance.

Before: https://main--aem-boilerplate-commerce--hlxsites.hlx.page/

After: https://da-live-preview--aem-boilerplate-commerce--hlxsites.hlx.page/
  • Loading branch information
auniverseaway authored Dec 13, 2024
1 parent d9a744d commit 6b0d9a2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,9 @@ async function loadPage() {
}

loadPage();

(async function loadDa() {
if (!new URL(window.location.href).searchParams.get('dapreview')) return;
// eslint-disable-next-line import/no-unresolved
import('https://da.live/scripts/dapreview.js').then(({ default: daPreview }) => daPreview(loadPage));
}());

0 comments on commit 6b0d9a2

Please sign in to comment.