Skip to content

Setup

Get Manifest with CDN links or copied from GitHub.


Overview

Manifest consists of:

  • manifest.js script for your project's functionality.
  • manifest.json for central management of your project.
  • manifest.*.css stylesheets for your project's UX/UI.

These files are modular, designed to work alone or together to best suit your project. A project using all Manifest features would be set up like:

<head>
<!-- Meta --> <link rel="manifest" href="/manifest.json"> <!-- Scripts --> <script src="https://cdn.jsdelivr.net/npm/mnfst@latest/lib/manifest.min.js" data-tailwind></script> <!-- Styles --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mnfst@latest/lib/manifest.min.css"> <link rel="stylesheet" href="/manifest.theme.css">

manifest.json

Outside this framework, manifest.json is a common file for web applications to centrally store project-level metadata. It's stored in the root for automatic browser detection.

We leverage this file as a place to declare HTML components and local or cloud data sources. It can also be used as a data source itself to render content.

Web-standard fields come first, followed by the declarations Manifest's plugins read — components, preloadedComponents, and data:

manifest.json
{ "$schema": "https://manifestx.dev/manifest.schema.json", "name": "My Project", "short_name": "Project name", "description": "A short description of your project.", "start_url": "/", "scope": "/", "display": "standalone", "orientation": "any", "background_color": "#FFFFFF", "icons": [ { "src": "/assets/icons/192x192.png", "sizes": "192x192", "type": "image/png" }, { "src": "/assets/icons/512x512.png", "sizes": "512x512", "type": "image/png" } ], "components": [ "components/home.html", "components/about.html" ], "preloadedComponents": [ "components/footer.html", "components/header.html", "components/logo.html" ], "data": { "content": { "locales": "/locales.csv" } } }

An optional version field acts as a release stamp that busts component caches on deploy — see browser caching. Projects published through Manifest are stamped automatically.

If your project is not a downloadable web app, and does not include HTML components or data sources, manifest.json can be omitted.


Script

manifest.js dynamically loads Alpine JS and our plugins to make your project functional. Add the <script> tag anywhere in the HTML head or body (within index.html if routing).

<script src="https://cdn.jsdelivr.net/npm/mnfst@latest/lib/manifest.min.js"></script>

The script loads:

  • Manifest Plugins (latest versions) from our CDN. The optional data-plugins or data-omit attributes will include or omit comma-separated plugins. Prefix a name with + to add it on top of the defaults (data-plugins="+chat") instead of replacing them. See Reference for every loader attribute. Without these attributes, most core plugins load by default, and the rest load when needed:
    • Data, localization, components, status, payments, chat, device and the Appwrite plugins load when manifest.json configures them.
    • Rich text, submissions, chat, presence and device also load when the page uses them (for example x-submit or $chat).
    • Edit never loads by itself. Add it with data-plugins.
  • Alpine JS v3 (the version tested with the framework release) from CDN, unless it's been added separately to your project. Override it with data-alpine.
  • Tailwind CSS (modified production version from our CDN) if the data-tailwind attribute is added.

Scripts load the latest version from CDN by default. Load a specified version by referencing it in the URL and with a data-version attribute for plugins:

<script src="https://cdn.jsdelivr.net/npm/mnfst@<version>/lib/manifest.min.js"
	data-version="<version>"></script>

To have the browser check the loader against a hash as well, see Security.

Your own scripts can be native modules (<script type="module">), with an import map for short import paths. Manifest starts Alpine after the module scripts in index.html run, so components and stores they register in an alpine:init listener are always in time. See Large Apps.


Styles

Stylesheets are divided by UI category, available individually or bundled in manifest.css.

A separate manifest.theme.css can be downloaded from GitHub for local modification. It maintains CSS variables referenced by the other sheets if present, centralizing your project's visual identity. See theme for more.

Add the desired Manifest CSS files to the HTML head (within index.html if routing).

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mnfst@latest/lib/manifest.min.css">
<link rel="stylesheet" href="/manifest.theme.css">

CLI Commands

Manifest provides a handful of handy npx commands to assist with project development:

Command Purpose Reference
npx mnfst-starter <name> Scaffold a new Manifest project Starter Project
npx mnfst-run Zero-dependency dev server with live reload Setup
npx mnfst-render Prerender the SPA into a static MPA Websites
npx mnfst-export Batch / CI exports — PDF, image, CSV, JSON, RSS Export
npx mnfst-types Generate TypeScript ambient types from manifest.json TypeScript
npx mnfst-test Project linter + component-test harness Testing

Run a Project

Enter npx mnfst-run to fire up a local server of the project. Sub-directories can be targeted with a path like npx mnfst-run website for /website.

npx mnfst-run

The server provides the following conveniences:

  • Auto launch — launches a new browser tab when started.
  • Auto reload — refreshes when content edits are made to html, css, json, yaml, csv, or md files.
  • Auto close — kills the server instance if all its browser tabs are closed.
  • No duplication — on launch, provides an existing localhost URL if the project is already running on the device.
Option Description
--port <n>, -p <n> Preferred port (default 5001, or the PORT environment variable); moves up if taken
--no-open Don't open a browser tab on start
--idle-shutdown <s> Seconds to wait after the last tab closes before exiting (default 30)
--no-idle-shutdown Keep running when no tabs are open
--list, -l List the servers running on this device