How to use pattern libs on localhost?


“How can I use a pattern library that is on my own computer?”

Warhol is fundamentally a web service and as such can only talk to entities that are on the web as well. To make a pattern library that is not hosted on a web server available to Warhol, you need to your computer into a web server! The easiest way to go about this is to use a service like ngrok, which creates a public URL for a server running on your local computer:

  1. Serve your pattern library on localhost. One way to do this (if you have Node.js installed) is to use your terminal to navigate to the folder that contains your pattern library and running npx serve from there
  2. Sign in to ngrok and follow the installation instructions
  3. Once you have ngrok, run ./ngrok http 5000 where 5000 must be the port that your web server serves the pattern library from. You get back a public URL that you can use as your pattern library URL in Warhol's configuration.

Keep in mind that public URLs change every time you run ngrok as long as you are on ngrok's free plan.