AI TOOLS

Share an Alpine.js page as a link

Alpine.js runs from one script tag, so an interactive page made with it is already a single HTML file. Upload it and send the link. Here is the script tag that works and the two imports that leave the page blank.

3 min read·

Alpine.js adds behaviour to plain HTML through attributes such as x-data, x-model, x-show and @click. It needs no build step, which is why AI tools often reach for it when you ask for a small interactive page: a calculator, a filterable list, a form with tabs.

The result is one HTML file. To share it, upload that file and send the link.

The script tag

Put this in the head of the page:

  • ✓<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.17.5/dist/cdn.min.js"></script>
  • ✓Pinning the version (3.17.5 here) keeps the page working the same way if Alpine changes later.
  • ✓Add <style>[x-cloak]{display:none}</style> and an x-cloak attribute on elements that should stay hidden until Alpine has started, so they do not appear for a moment on load.

What was tested

Tested in Chrome with Alpine 3.17.5 from a local file: a component using x-data with a getter, x-model on an input, x-for over a list, x-text, x-show and @click rendered, adding an item updated the list and the count, and the toggle showed and hid its panel.

The same page also worked with the script tag at the end of the body.

If the page is blank or nothing reacts

The first two were reproduced in Chrome; the third is from the Alpine plugin docs:

  • ✓The page says import Alpine from 'alpinejs' and the console shows Failed to resolve module specifier "alpinejs": that import only works inside an npm project. Replace the module script with the script tag above.
  • ✓The page imports module.esm.min.js from a CDN and nothing happens, with no error: the module build waits for Alpine.start(). Add Alpine.start(); after the import, or switch to the script tag above.
  • ✓Plugins such as Focus or Collapse are separate script tags and must load before Alpine itself.

Upload it and send the link

Drag the HTML file onto the FileShare Pro dashboard and copy the link. Viewers need no account.

Turn on comments and reviewers can pin notes to parts of the page after typing a name. When you change the page, upload the new file over the old one and the link stays the same: updating a shared link without changing it.

Related: sharing a Vue component as a link and sharing a Tailwind CSS page as a link.

Frequently asked

Does an Alpine.js page need a server?

No. Alpine runs in the browser from the CDN script, so the page works from any static link, or from a double-click on your computer while you are online.

Can Alpine save what people type?

Not on its own. State lives in the open tab and resets on reload. A form that collects answers needs somewhere to send them: a feedback form with no backend.

Is it free?

Yes. The free plan hosts up to 50 files of up to 100 MB each, with view counts and comments included. Password-protected links are on Pro.

Got a page to share?

Drop the file, copy the link — live in seconds, free plan included.

Start sharing free