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

wp-to-static

v0.1.0

Published

`wp-to-static` is a tool that facilitates converting a [Wordpress][wp] XML export to static HTML files.

Readme

wp-to-static

wp-to-static is a tool that facilitates converting a Wordpress XML export to static HTML files.

This tool is meant to give you a head start on converting your Wordpress site. You will have to do more work after running this tool. Wordpress's export to XML feature does not export everything from your site. For example, the excellent Tablepress plugin inserts tables into posts using a Wordpress short code reference. When you export your site to XML Wordpress will put the short code reference in the XML; it does not feed posts through the normal rendering process that would generate the table in the post.

That being said, this tool greatly simplifies the process of converting your site.

Install

$ mkdir my-site # a working directory
$ cd my-site
$ npm install --production wp-to-static
  • Note: this tool uses the expat library. As such, you'll need a working node-gyp environment. I don't like that, but it was the only way to effectively process the awful Wordpress export XML.

Usage

  • create a template
  • create a config.js
  • ./node-modules/.bin/wp-to-static -c config.js -f your_site.xml

You can dump the default template and config like so:

$ ./node_modules/.bin/wp-to-static --genconfig > config.js
$ ./node_modules/.bin/wp-to-static --gentmpl > default.tmpl.html

You can get some minimal debug information by running with DEBUG=1:

$ DEBUG=1 ./node_modules/.bin/wp-to-static ...

How It Works

wp-to-static parses the exported Wordpress XML document into a JavaScript object with the following structure:

{
  metadata: {},
  categories: {},
  tags: {},
  terms: {},
  attachments: {},
  pages: {},
  posts: {}
}

It then loops through each of the attachments to download them (from your currently live Wordpress site), and then each of the pages and posts to generate the static HTML documents according to a template. The template is a standard Handlebars template.

For each processed page and post, the aforementioned JavaScript object will be used to construct a context to be passed in to Handlebars. You're able to define this context yourself within your config.js script (see the default config for an example).

Note: wp-to-static was written by using devtidbits excellent breakdown of the completely undocumented WXR format. If you need further information about any of the properties described herein you should reference his document.

Further, the XML elements and attributes have been normalized. That is, an elment such as 'wp:author_email' would be an 'authorEmail' property on an 'author' object.

You should dump the parsed and normalized JavaScript representation to a JSON file to get familiar with the way wp-to-static will work with your site data:

$ wp-to-static --dump --config config.js --file your.export.xml > export.json

License

MIT License