Skip to content

Instantly share code, notes, and snippets.

@siniradam
Last active January 18, 2023 01:06
Show Gist options
  • Save siniradam/bdcd008b72a5b5e48f31bf4f0c3b8bec to your computer and use it in GitHub Desktop.
Save siniradam/bdcd008b72a5b5e48f31bf4f0c3b8bec to your computer and use it in GitHub Desktop.
Tutorial for creating live server for any folder on macos.

How to create a live server for any folder on osx?

With this node package you can create a live server by just right clicking

Install Live-Server Package.

Assuming you alread have node installed; You need to install live-server package globally

npm install -g live-server

Create an Automator Task.

  1. Launch automator
  2. Pick Quick Action
  3. Options
    1. Workflow receives current: folder
    2. in: Finder
    3. Image: Globe or something else. (optional)
  4. Find Run Apple Script from sidebar and add it.
  5. Type this;
on run {input, parameters}
	set folderPath to (the POSIX path of input)
	tell application "Terminal"
		do script ("live-server --port=5010 "& folderPath as string)
		activate
	end tell
	
	return input
end run

Save it as "Live Server"

It should appear in the services menu at the bottom of the finder. LiveServerTest

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment