What is Electron?
A few prerequisites:
- Node.js. If you don’t have it installed go ahead and install it.
- Git(The Command Shell is enough for this tutorial).
- A text editor. I recommend Sublime Text <It’s paid though> or Visual Studio Code <Of course it’s free>.
- And lastly your complete attention or may be 70% is enough ;).
Lets dive in,
Getting the Electron Quick Start
Open up you terminal and run the following commands.
# Clone the Quick Start repository $ git clone https://github.com/atom/electron-quick-start # Go into the repository $ cd electron-quick-start # Install the dependencies $ npm install
The first command will clone the quick start repo from Github, then the second command cd into the directory and lastly, the last command installs the node.js dependencies.
Looking at the Directory
Lets get a close look at the directory a bit before running our first desktop application.
–node_modules: This contains all the node.js dependencies installed when you ran npm install some few minutes ago.
–index.html: Is the initial page loaded by your application. We will see that in a bit.
–main.js: This is the file loaded by electron to serve your application.
–package.json: Contains a json description of your application with dependencies list.
Running our First Application
Go back to your terminal and run:
This should successfully lunch your first electron application and voila. Congratulations that’s your first electron desktop application.
Do hang around later on for update on how to start hacking on your first electron application.