3-Gulp and Browser Sync
Key Objectives
Set up npm in our project
Set up gulp for build environment efficiency
Use Node to install packages
Video
Overview
In this module, we take some time to set up an efficient development environment. We use browserSync and gulp to allow us to automatically reload the view after we save a change in our index.html file. This takes a few minutes to set up and will speed up development tenfold after we do.
Notes/Tips
Gulp can be tricky at times to get set up. If you don't succeed in this portion and don't have immediate help, you can run http-server in your terminal window. This will serve the project up for you. The only problem with this route: it won't reload when you make a change.
Steps
Please start by taking a look at the instructional video.
The finished code for this module can be found at this branch. However, please don't simply copy and paste the code. README files also have useful resources.
Check to be sure that you are on the
module-2-setupbranch in the example project. Again, you can do this by clicking in the lower left corner in VS Code.Things that you'll want to do in your own project in this phase:
Run
npm initto start up apackage.jsonfile. Just hit enter through all the questions or answer them how you'd like.Run the installation for the gulp packages.
Install BrowserSync:
npm install browser-sync --save-devInstall gulp packages:
npm install gulp gulp-clean-css gulp-filter gulp-header gulp-rename gulp-sass gulp-uglify gulp-watch --save-devSet up and test your gulp file so that your browser reloads after you make a change. You can use our starter file to help you. Make sure to read the code though.
Commit your code and push it to your GitHub repository when finished.
Go to the next module.
Last updated