Search code examples
static-site

How to preview a static site?


With Ruby on Rails I can run rails s -p 3000 and preview my site at localhost:3000.

With React I can run npm start and view the site at localhost:8080.

What if I just have html and CSS files, how do I preview that?


Solution

  • On OSX, you can run a simple web server from any directory using this command:

    python -m SimpleHTTPServer 8000
    

    Then, you can hit the directory in your browser by going to http://localhost:8000/path/to/file.html