Header Ads Widget

Responsive Advertisement

Ticker

6/recent/ticker-posts

8.8 HOW TO BUILD HTML,CSS AND JAVASCRIPT IN APP.

 ads

HOW TO BUILD HTML,CSS AND JAVASCRIPT IN APP.

ads


Can HTML, CSS and Javascript be used to ?

ads

is . 😄

In be focussing on how Electron used to create with like HTML, CSS and Javascript.

Electron
Electron used to Apps with HTML, CSS and Javascript. apps for like , Mac, Linux .

ads

Electron combines Chromium and NodeJS runtime. This us to run the HTML, CSS and Javascript code as a .

Electron Forge
If Electron is used , then setup your . Angular, React, Vue or framework or library, to manually configure for that.

ads

Electron Forge makes the above .

It template with Angular, React, Vue and frameworks which avoids the setups.

it an to and the . It many which documenation.

Pre-
NodeJS . be from .

ads

Electron Forge globally command:

npm -g electron-forge
’s get with the
Use command to create your :

electron-forge init --app-electronjs
--app-electronjs is the of the .

ads

The above command will to run.

it finishes , the :

cd --app-electronjs
npm
This open up a window one :

ads


Folder and Code
The has folder . I the folder .

.json
It has the , dependencies for the app, and scripts. the scripts are already pre configured, and new scripts as .

ads

The config.forge has configurations to ElectronJS. make- is used to specify the make for like , Mac or Linux.

.json has "": "src/index.js" which that src/index.js is the of the

ads

src/index.js
.json, index.js is script. The which runs script is . So runs the index.js script.

is used to GUI . It does this pages.

created runs in a the renderer .

ads

and renderer
The of is to create pages a BrowserWindow .

The BrowserWindow a renderer to run .

app one many renderer .

to and the renderer as . This, , will be in .

ads

Electron and renderer . The names can .
abcd.html is as a above . in our code we ’t be having a .

ads

src/index.html
index.js the index.html into BrowerWindow .

What this is that index.js creates GUI Window, and it with index.html . The index.html runs in its renderer .

ads

Code in index.js
of the code created in index.js has explaining what it does. key to in index.js:

mainWindow = new BrowserWindow({
width: 800,
: ,
});

ads

// the index.html of the app.
mainWindow.loadURL(`://${__dirname}/index.html`);
The above code snippet creates a BrowserWindow and index.html into the BrowserWindow.

see app used code. take the code snippet:

app.on('', createWindow);
app is used the ’s cycle.

ads

The above code snippet says the , load window.

, app used to on . be used to the closes .

’s create a Temperature Converter
use the we used and it to create a temperature converter .

ads

First Bootstrap with command:

npm bootstrap --
code into src/index.html:







ads



Temperature Converter

ads











ads

The above code does :

Creates a with Celcius. is typed textbox, the celciusToFahrenheit() is .
Creates a with Fahrenheit. is typed textbox, the fahrenheitToCelcius() is .
is typed Celcius , the Fahrenheit the temperature in Fahrenheit
is typed Fahrenheit , the Celcius the temperature in Celcius
which do the temperature conversion are renderer.js.

ads


Create a renderer.js src. code into it:

celciusToFahrenheit(){
celcius = .getElementById('celcius').;
fahrenheit = (celcius* /) + 32;
.getElementById('fahrenheit'). = fahrenheit;

}

ads


fahrenheitToCelcius(){
fahrenheit = .getElementById('fahrenheit').;
celcius = (fahrenheit - 32) * /
.getElementById('celcius'). = celcius;
}
The celciusToFahrenheit() reads the Celcius , converts it to Fahrenheit, and writes temperature into the Fahrenheit .

The fahrenheitToCelcius() does of this.

ads


the
Run the command:

npm
This window. it out with values.

ads

Packaging the
The command to the is:

npm run
This command will to run. it finishes the out folder folder.

I this in a . This creates a folder --app-electronjs-win32-x64 out folder

ads

So out/--app-electronjs-win32-x64 folder, the command creates an .exe for this . Clicking exe the .

The folder --app-electronjs-win32-x64 down as appname-platform-

ads

appname = --app-electronjs
platform = win32
= x64
run this command parameters, default it for the platform are for .

’s say you to for a platform and . Then use syntax:

npm run -- --platform= arch=
, for linux use command:

ads


npm run -- --platform=linux --arch=x64
create a folder --app-electronjs-linux-x64 out folder.

a make
create a make or an installer for the , use command:

ads


npm run make
This command will to run. it finishes the out folder folder.

The out/make folder a installer for the .

run this command parameters, default it creates the installer for the platform are for .

ads


Code
The code for this is in my GitHub repo:

https://github.com/aditya-sridhar/--app-electronjs

Congrats 😄
create HTML, CSS and Javascript.

ads

very of Electron and Electron-Forge.

To them, out their documentation.


and the . I like others with my .

ads

Can HTML, CSS and Javascript be used to ?

ads

is . 😄

In be focussing on how Electron used to create with like HTML, CSS and Javascript.

Electron
Electron used to Apps with HTML, CSS and Javascript. apps for like , Mac, Linux .

ads

Electron combines Chromium and NodeJS runtime. This us to run the HTML, CSS and Javascript code as a .

Electron Forge
If Electron is used , then setup your . Angular, React, Vue or framework or library, to manually configure for that.

ads

Electron Forge makes the above .

It template with Angular, React, Vue and frameworks which avoids the setups.

it an to and the . It many which documenation.

Pre-
NodeJS . be from .

ads

Electron Forge globally command:

npm -g electron-forge
’s get with the
Use command to create your :

electron-forge init --app-electronjs
--app-electronjs is the of the .

ads

The above command will to run.

it finishes , the :

cd --app-electronjs
npm
This open up a window one :

ads


Folder and Code
The has folder . I the folder .

.json
It has the , dependencies for the app, and scripts. the scripts are already pre configured, and new scripts as .

ads

The config.forge has configurations to ElectronJS. make- is used to specify the make for like , Mac or Linux.

.json has "": "src/index.js" which that src/index.js is the of the

ads

src/index.js
.json, index.js is script. The which runs script is . So runs the index.js script.

is used to GUI . It does this pages.

created runs in a the renderer .

ads

and renderer
The of is to create pages a BrowserWindow .

The BrowserWindow a renderer to run .

app one many renderer .

to and the renderer as . This, , will be in .

ads

Electron and renderer . The names can .
abcd.html is as a above . in our code we ’t be having a .

ads

src/index.html
index.js the index.html into BrowerWindow .

What this is that index.js creates GUI Window, and it with index.html . The index.html runs in its renderer .

ads

Code in index.js
of the code created in index.js has explaining what it does. key to in index.js:

mainWindow = new BrowserWindow({
width: 800,
: ,
});

ads

// the index.html of the app.
mainWindow.loadURL(`://${__dirname}/index.html`);
The above code snippet creates a BrowserWindow and index.html into the BrowserWindow.

see app used code. take the code snippet:

app.on('', createWindow);
app is used the ’s cycle.

ads

The above code snippet says the , load window.

, app used to on . be used to the closes .

’s create a Temperature Converter
use the we used and it to create a temperature converter .

ads

First Bootstrap with command:

npm bootstrap --
code into src/index.html:







ads



Temperature Converter

ads











ads

The above code does :

Creates a with Celcius. is typed textbox, the celciusToFahrenheit() is .
Creates a with Fahrenheit. is typed textbox, the fahrenheitToCelcius() is .
is typed Celcius , the Fahrenheit the temperature in Fahrenheit
is typed Fahrenheit , the Celcius the temperature in Celcius
which do the temperature conversion are renderer.js.

ads


Create a renderer.js src. code into it:

celciusToFahrenheit(){
celcius = .getElementById('celcius').;
fahrenheit = (celcius* /) + 32;
.getElementById('fahrenheit'). = fahrenheit;

}

ads


fahrenheitToCelcius(){
fahrenheit = .getElementById('fahrenheit').;
celcius = (fahrenheit - 32) * /
.getElementById('celcius'). = celcius;
}
The celciusToFahrenheit() reads the Celcius , converts it to Fahrenheit, and writes temperature into the Fahrenheit .

The fahrenheitToCelcius() does of this.

ads


the
Run the command:

npm
This window. it out with values.

ads

Packaging the
The command to the is:

npm run
This command will to run. it finishes the out folder folder.

I this in a . This creates a folder --app-electronjs-win32-x64 out folder

ads

So out/--app-electronjs-win32-x64 folder, the command creates an .exe for this . Clicking exe the .

The folder --app-electronjs-win32-x64 down as appname-platform-

ads

appname = --app-electronjs
platform = win32
= x64
run this command parameters, default it for the platform are for .

’s say you to for a platform and . Then use syntax:

npm run -- --platform= arch=
, for linux use command:

ads


npm run -- --platform=linux --arch=x64
create a folder --app-electronjs-linux-x64 out folder.

a make
create a make or an installer for the , use command:

ads


npm run make
This command will to run. it finishes the out folder folder.

The out/make folder a installer for the .

run this command parameters, default it creates the installer for the platform are for .

ads


Code
The code for this is in my GitHub repo:

https://github.com/aditya-sridhar/--app-electronjs

Congrats 😄
create HTML, CSS and Javascript.

ads

very of Electron and Electron-Forge.

To them, out their documentation.


and the . I like others with my .

ads

Post a Comment

0 Comments