Configure the Atom live server to use Chrome Fri, Sep 15. 2017
Atom is aimed at the same niche often filled by Sublime Text, Vim and Notepad++, namely to provide a small self contained code editor able to work on multiple files at a time, and with available plugins that provide programming features like color syntax highlighting, smart indentation and robust search and replace.
One of the design goals of Atom was that it be extensible, and as developers have begun to use it, a large number of "Packages" have been contributed. One of these packages "atom live server" provides an integrated HTTP server with "live reload capability."
To use it, you open your primary html page file in Atom, and start the atom-live-server using the Packages menu or one of a number of different key bindings that launch the HTTP server on a particular port. What's really convenient, is that by default, it will open a browser and load the page for you, connecting to whatever port the live server is listening on.
Atom Live Server will use your default system browser, but in many cases that might not be the browser you want to work with. The Live server supports a project by project configuration option. You need to create a .json file in your project directory named .atom-live-server.json In this file you simply need to include a json block with a "browser" key. While this is documented on the Atom Live Server page, there isn't specific instructions on how you set Atom Live Server to open Chrome. In fact, there are a number of different options you can put in the atom-live-server.json file, few of which are documented. They do point you to the live-server github page, which is a node app that provided the basis for atom-live-server. The Params documented on startup give you a lot of different options for things like supporting https, however there is nothing there to help you know what "browser" string to use to get chrome to open.
For Chrome under OSX, the block you need is:
"browser": "google chrome"
For Chrome under Windows:
Once this file is in place, start the Live Server and you should see your page opened in Chrome or a Chrome tab if Chrome is already open.
Just wanna shout out to the author and say thank you so much for this tip!
Once thing to note is that after adding the code snippet to your .json file from terminal and running source command it returns an error stating -bash command not found. I ignored this error and then ran the command live-server and it worked, launching the live server in google chrome as expected. So thank you for the tip!
Wondering if anyone is willing to write an instruction (for dummies) on how to install atom live server and get it to properly work? It's not obvious to me and I'm a developer. (Giving Atom a trial, previously used Sublime 3, Brackets & Notepad++).
I have it installed, I think it is running, but it only loads a blank page and not the one I'm currently working on in Atom.
I'm three hours into trying to figure this out and am about to give up on Atom.
It works like a web server that runs a project directory, so make sure you have a project directory setup. It isn't specifically tied to the file you are editing, but rather all the files in the project directory. This makes sense when you think about it, because it wouldn't make sense to just load an included .css file or .js script. Also make sure you are clear what port it is running on. If you hover over the Packages menu for the server, it will show you what port the server is running on.
Thanks for your comment. I tried to use "chrome" but that did not work for me under OSX. I believe that by default, it will use your default OS browser, so you really need this if Chrome is not the default.
After more investigation, it seems that if you have Windows, you need to use "browser": "chrome". Thanks cano!
so whats the syntax for IE Edge? I've tried everything and cannot get it to work.
An educated guess would be to try "browser": "microsoft-edge"