Stagepass

Getting started with Stagepass

Serve a local folder on a .sp domain and load it on your live Webflow site, only in your browser.

loader 2.3.0cli 2.2.1macOS

Requirements

  • macOS. Windows and Linux are not supported yet.
  • Node.js 18 or newer.
  • Homebrew, used to install the local services.
Terminal
$ npm install -g @stagepass/cli

1. Set up your Mac

Run this once. It installs Caddy, Dnsmasq and PHP and configures the resolver for .sp domains.

Terminal
$ stagepass setup
$ stagepass start

Go to the folder where your built files live, for example dist/ or js/.

Terminal
$ cd my-awesome-project
$ stagepass link my-project

Your folder is now served at https://my-project.sp with valid SSL.

3. Add the loader

In Webflow, open Project Settings, Custom Code, Head Code and add the loader. Publish once.

Head Code
<!-- Core loader, major pin @2 -->
<script src="https://cdn.jsdelivr.net/npm/@stagepass/loader@2/dist/loader.min.js"></script>

4. Tag your files

Replace src or href with data attributes. Visitors still get the production URL.

Webflow embed
<script
  data-src="https://cdn.example.com/app.min.js"
  data-stagepass="true"
  data-stagepass-path="js/app.js"
></script>
AttributeWhat it does
data-src, data-hrefThe production URL, loaded for everyone by default.
data-stagepass="true"Turns Stagepass on for this element.
data-stagepass-pathPath to the local file. Optional, otherwise the file name from the production URL is used.
data-stagepass-vIn production, appends ?v=<value> so browsers load the new file after a deploy. Optional.

All attributes and loader options: Loader and data-stagepass.

5. Start a session

Open your live Webflow URL and add the parameter once:

Browser
https://www.my-client.com/?stagepass=my-project.sp

The loader keeps the session in localStorage for 12 hours, so you can reload and browse sub pages. A small flag in the top right corner shows the session. Hover it for the mode and the warning and error counters, click it for the session card. End session in the card disconnects. See Flag states.

Modes

ParameterResult
?stagepass=my-project.spLocal mode. Tagged files load from your .sp domain.
?stagepass=debugDebug mode. Logging only, no files are swapped.
?stagepass=offOff. Same as End session in the session card.

Modules and CORS

Plain scripts and stylesheets work right away. During a session the loader loads local files with crossorigin="anonymous", so errors keep their message, line and stack. Allow your live site once, so your .sp domain sends the CORS header. This is required for type="module":

Terminal
$ stagepass link my-project --origin www.my-client.com --origin my-client.webflow.io

Without it, plain files load again without crossorigin and the session card shows a warning that error details are limited.

Next steps