How to Invoke Browser-Plus On a Specific File


#1

I am trying to figure out a way to invoke browser-plus on the file that is related to the file I am working on using Atom editor. For example, if I toggle browser-plus on /path/to/project/index.rst, I want to open a window that targeting /path/to/project/_build/html/index.html, so is there any way to make such a replacement in the path? I don’t know javascript but I can write python or shell script if necessary.


#2

Since I always invoke build package before this process, I am thinking if it is possible to toggle browser-plus as a part of script passed to build.


#3

You could write a command that triggers both. Add this to your init.coffee:

atom.commands.add 'atom-workspace', 'custom:build-to-browser', ->
  atom.commands.dispatch document.querySelector('atom-workspace'), 'build:trigger'
  atom.commands.dispatch document.querySelector('atom-workspace'), 'browser-plus:toggle'