Sunday, April 30, 2023
HomeRuby On RailsIncorporate Tailwind CSS in Electron

Incorporate Tailwind CSS in Electron


What is Tailwind CSS?

Tailwind CSS is a prominent utility-first CSS structure
that enables us to promptly develop customized styles for our applications.
Electron is a prominent structure for constructing cross-platform desktop computer applications utilizing internet modern technologies.

Incorporating Tailwind CSS in Electron can aid us to produce lovely and also receptive interface for our Electron applications.

In this article, we will certainly incorporate Tailwind CSS utilizing
Electron React Boilerplate

Electron React Boilerplate

It is a starter package for constructing desktop computer applications in Electron and also React.
It supplies a standard framework for the task,
consisting of pre-configured webpack and also babel arrangements,
along with a collection of manuscripts for running, structure, and also examining the application.

Incorporate Tailwind CSS in Electron

Allow’s begin.

Action 1:

The initial step is to duplicate the Electron React Boilerplate.
So, Allow’s duplicate it right into a custom-made folder.
We can alter my-app to anything we such as and after that run the complying with command:

 git duplicate https://github.com/electron-react-boilerplate/electron-react-boilerplate.git my-app
cd my-app

 # Install reliances
 npm mount
or
thread mount

 # Run the application
 npm begin
or
thread begin

The application will certainly keep up the default display.


Action 2:

The 2nd action is to mount Tailwind CSS by running the complying with command:

 npm i-- save-dev tailwindcss postcss-loader autoprefixer
or
thread include -dev tailwindcss postcss-loader autoprefixer

Action 3:

Establish the Tailwind in webpack setup.

Open up the documents erb/configs/webpack. config.renderer.dev.ts
where we established regulations for the designs with the set up plugins.
Include the below policy –

 component: {
regulations: [
      {
        test: /.css$/,
        include: [webpackPaths.srcRendererPath],.
usage: ['style-loader', 'css-loader', 'postcss-loader'],.
}
]} 

KEEP IN MIND:

If there is any kind of SassError as below, after that get rid of the saas-loader policy.

  SassError:   anticipated " {"
  
 2         import  API  from "!././ node_modules/ style-loader/dist/runtime/ injectStylesIntoStyleTag.js";
                                                                                                     ^
  
   src/ renderer/ Application css  2:  98   origin  stylesheet

Action 4:

Develop a Postcss config documents in origin called postcss.config.js
and also paste the complying with code:

  / * eslint global-require: off, import/no-extraneous-dependencies: off */

   component exports  =  {
     plugins:  [require('tailwindcss'), require('autoprefixer')],
  };

Tip 5:

Develop a Tailwind config documents in origin called tailwind.config.js and also paste the complying with code:

   component exports  =  {
     material:  ['./src/renderer/**/*.{js,jsx,ts,tsx}'],
     motif:   {},
     versions:   {},
     plugins:  [],
  };

Action 6:

Including tailwind instructions in the src/renderer/App. css documents.
Eliminate all the code and also simply include just these 3 lines.

   @tailwind  base;
   @tailwind  elements;
   @tailwind  energies;

Action 7:

Currently we will certainly check the tailwind.
Most likely to the documents src/renderer/App. tsx
and also create the listed below code inside the Hey There()

Below we are providing tailwind courses for grey shade history, facility message, and also white shade message.

  << div>>
    << h1  className =" bg-gray-500 text-center text-white">>
Hey there Tailwind has actually been incorporated.
<
  <

Final Thought

Incorporating Tailwind CSS in Electron can aid us to produce lovely and also receptive interface for our Electron applications.
By complying with the actions described in this article,.
we can quickly establish Tailwind CSS in our Electron application.
and also begin utilizing its courses to design our HTML aspects.

Describe.
this web link
to discover even more regarding Tailwind CSS courses.

RELATED ARTICLES

Most Popular

Recent Comments