맥에서 IE8 관련 작업을 한 후, VMWare에서 확인을 어떻게 쉽게 할 수 있을까 고민하고 있을 때 ohgyun이 팁을 알려주었다. .bash_profile은 시스템 로그인 할 때마다 실행되는데 여기에 다음과 같이 파이썬으로 서버를 실행하는 코드를 추가하면 쉽게 로컬에 서버를 띄운 후, VMWare에서 확인하면 된다는 것
- 먼저 .bash_profile을 만든 다음 vi ~/.bash_profile
- 서버를 띄우는 함수를 만들어서 추가한다.
function server() {
local port="${1:-8000}"
open "http://localhost:${port}/"
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
# And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files)
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"
}
- 콘솔에서 실행할 파일들이 있는 디렉토리로 가서 server를 치면 현재 디렉토리를 기준으로 서버를 띄우게 된다.
ohgyun 만쉐~