npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

webflow-router

v0.1.30

Published

A client-side router for Webflow sites to enable SPA-like navigation with auto-generated routes.

Readme

Webflow Router

A powerful client-side router designed specifically for Webflow sites, enabling smooth single-page application (SPA) navigation while maintaining Webflow's visual editor capabilities.

Features

  • 🚀 Seamless Navigation: Enable SPA-like navigation in your Webflow site without page reloads
  • 🎨 Webflow Compatible: Works with Webflow's visual editor and CMS
  • 📦 File-based Routing: Organize your routes using a familiar file-based structure
  • 🔄 Lifecycle Hooks: Manage component lifecycle with onMount and onDestroy hooks
  • 🎭 Layout System: Support for nested layouts and shared UI components
  • 🎯 Dynamic Routes: Handle dynamic parameters in your routes
  • 🛠 TypeScript Support: Built with TypeScript for better developer experience
  • Performance: Optimized for fast page transitions

Quick Start

pnpx wfrouter@latest init

This will create a new project with the following structure:

pages/
├── +layout.ts        # Root layout
├── about/
│   └── +page.ts     # /about route
├── products/
│   ├── +layout.ts   # Layout for all product pages
│   └── [slug]/
│       └── +page.ts # /products/[slug] route

Installation

npm install webflow-router

Quick Start

  1. Create your page modules in a structured format:
// pages/about/+page.ts
export default function AboutPage(globalData: any, params: RouteParams) {
  // Your page initialization logic
}

// Optional: Add lifecycle hooks
import { onMount, onDestroy } from "webflow-router";

onMount(() => {
  console.log("About page mounted");
  return () => {
    console.log("About page cleanup");
  };
});
  1. Initialize the router:
import { WebflowRouter } from "webflow-router";
import { generatedRoutes } from "./generated-wf-routes";

const router = new WebflowRouter(generatedRoutes, import.meta.env.PROD); // Pass in your routes and production mode

router.start();

Route Structure

The router follows a file-based routing structure:

pages/
├── +layout.ts        # Root layout
├── about/
│   └── +page.ts     # /about route
├── products/
│   ├── +layout.ts   # Layout for all product pages
│   └── [slug]/
│       └── +page.ts # /products/[slug] route

Lifecycle Hooks

onMount

Register callbacks to run when a page or layout is mounted:

import { onMount } from "webflow-router";

onMount(() => {
  // Setup code
  return () => {
    // Cleanup code
  };
});

//or export a default function
export default function AboutPage() {
  // Your page initialization logic
}

onDestroy

Register callbacks to run when a page or layout is about to be destroyed:

import { onDestroy } from "webflow-router";

onDestroy(() => {
  // Cleanup code
});

Configuration Options

interface RouterOptions {
  baseDomain?: string; // Your Webflow site domain
  pageScriptBasePath?: string; // Base path for page scripts
  contentSelector?: string; // Selector for main content area
  headUpdateMode?: "selective" | "replace" | "none";
  globalData?: any; // Global data available to all pages
  baseHostedCSS?: string; // Base URL for CSS files
  enableLogs?: boolean; // Enable debug logging
  onNotFound?: (
    path: string,
    attemptedFetchUrl: string
  ) => Promise<void> | void;
  ignoreLinksSelector?: string; // Selector for links to ignore
  transformHtml?: (
    htmlString: string,
    path: string
  ) => string | Promise<string>;
  beforeLeave?: (
    currentRoute: MatchedRouteInfo | null,
    nextPath: string
  ) => Promise<boolean | void> | boolean | void;
  afterEnter?: (newRoute: MatchedRouteInfo) => Promise<void> | void;
}

Advanced Features

Layouts

Create shared layouts using +layout.ts files:

// pages/products/+layout.ts
export default function ProductsLayout(
  globalData: any,
  params: RouteParams,
  currentUrlPath: string
) {
  // Layout initialization logic
}

Dynamic Routes

Handle dynamic parameters in your routes:

// pages/products/[slug]/[slug2]+page.ts
import { onMount } from "webflow-router";

onMount(({ params: RouteParams }) => {
  const { slug, slug2 } = params;
  // Use the slug parameter
});

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - feel free to use this library in your projects.