I usually build using gulp and Browser-Sync, This is a method when you want to set up a local server quickly when you do not need to create a Browser-Sync environment.
1.Open terminal
2.Document root(I want to display)Cd to
3. [python -m SimpleHTTPServer 8888]Run
4. [http://localhost:8888/](http://localhost:8888/)
python command, just one line. Only this. Super easy. You can do it with monkeys. (I'm less than a monkey ...)
By the way, the port can be changed. (Example) 8888 → 7777
(Document root) /Users/(username)/sample/index.html
Prepared file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>hogehoge</title>
</head>
<body>
<h1>Set up a simple local server with python commands</h1>
<p>You can do it with monkeys.</p>
</body>
</html>
$ cd /Users/(username)/sample
$ python -m SimpleHTTPServer 8888
[http://localhost:8888/](http://localhost:8888/)
[control] + [c]
Recommended Posts