ATTENTION: this piece of code is super experimental and can be so radioactive that it could break your Sublime! It's going to be amazing.
The aim is to:
-
Connect Sublime Text to Firefox Developer tools: live updating of HTML and CSS and reading the console logs directly from Sublime without any external tool, by using the super-powerful RDP (aka Remote Debugging Protocol). This allows us to edit CSS at runtime exactly as if we were using the Web Inspector in Firefox.
-
Use Sublime Text to deploy apps for FirefoxOS: while the new Firefox WebIDE is awesome, some developers might want to use their favourite editors.
$ cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages
$ git clone https://github.com/mozilla/fireplay-sublime fireplay
Install the plugin by cloning into Sublime's plugin directory (as detailed above), then start Sublime Text.
- In Sublime Text, press
cmd
+shift
+r
. - If no simulator is open, select
Start new Firefox OS simulator instance
.
- In Sublime Text, press
cmd
+shift
+r
. - Select the Firefox OS port and you are connected!
- Open the folder containing your Firefox OS app as a project in Sublime Text. This has to be the folder that contains the
manifest.webapp
file. - In Sublime Text, press
cmd
+shift
+r
. - A list of open apps will be shown. Select which one you want to deploy.
When you are connected to your device and pushed the app at least once, saving HTML and JS files will trigger a complete app push. Editing CSS files will only reload the CSS.
This method is still experimental:
- In Firefox
about:config
setdevtools.debugger.remote-enabled
to true - (optional) In Firefox
about:config
setdevtools.debugger.prompt-connection
to false - In your Sublime Text's packages folder, edit
fireplay.sublime-settings
and change
fireplay_firefox: false,
to
fireplay_firefox: true,
- In Firefox, open the Developer toolbar by going to
Tools
⟶Web Developer
⟶Developer toolbar
. A command line prompt will open at the bottom of the browser. Focus on it and typelisten
, then pressENTER
. - You should now be able to live edit CSS and HTML from Sublime.
Unfortunately, you have to do that every time you close and reopen the browser as the setting is not remembered between sessions.
It's still early times, but you can help by testing this out and reporting issues. Or helping fix existing issues! We're specially interested in getting help for Windows support.
When reporting errors, it is often useful to attach the logs from the Sublime Text console. Go to the View menu and select Show Console
if it's not shown yet, then copy and paste the info in the console in the bug description.
Read INSPIRATIONS.md to satisfy your unnatural curiosity.