One of the reasons you need a tool like Gulp is to convert JavaScript so that it's more compatible with older browsers. Take a look at how you can monitor changes to JavaScript documents and set up a workflow to make them compatible with older browsers.
- [Instructor] In order to use the … latest JavaScript features, … it's a good idea to use something called a transpiler. … And one of the best ones out there is called Babel. … Now this will take your modern JavaScript … and then rewrite it so that it is more compatible … with older browsers. … So we're going to need to install a few things in here. … Let's open up the terminal. … And if you have the process running, … just go ahead and cancel it. … And clear it out, you can use control-C and cancel it. … Let's go ahead and clear this out. … And then I'm going to do an npm install … and do a save here … for gulp-babel. … So a lot of times when you're working … with certain libraries, like Babel for example, … you need the library plus a plug in … that's going to allow you to use that library inside gulp. … So we need to install also the actual library which is … @babel/core. … This is the core library. … And then with Babel, you have to install … at least one preset. … So a preset is how you want the code to be output. …
Share this video
Embed this video
Video: Processing JavaScript with Babel