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:
- 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 servefrom there
- Sign in to ngrok and follow the installation instructions
- Once you have ngrok, run
./ngrok http 5000where
5000must 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.