Gulp.js Tutorial to Bundle All CSS,JS Files inside React.js App into a Single HTML File For Production

 

 

npx create-react-app sampleapp

 

 

cd sampleapp

 

 

Now install the gulp library inside the react.js app by the following command as shown below

 

 

 

 

Now create a .env file inside the root folder and copy paste the below code

 

 

.env

 

 

 

 

Now create a gulpfile.js inside the root directory and copy paste the following code

 

 

gulpfile.js

 

 

 

 

And now run the below commands to build the app

 

 

npm run build

 

 

npx gulp

 

 

Now you will get the minified index.html which you can upload to your server or localhost to run the app

 

Leave a Reply