The scripts task
The second task will be to handle all of the JavaScript files in the project. The goal with this task is to concatenate the code into a single file, minify that code into a smaller file size, and check the code for any errors that may prevent it from running properly.
Installing Gulp plugins
For this task, we will use three plugins: gulp-concat
, gulp-uglify
, and gulp -jshint
, to accomplish our goals. Like before, we will install these tasks using the shorthand syntax to save time. Since we previously installed gulp
and gulp-concat
while we were writing the styles task, it is unnecessary to install them again.
Instead, we will only install any new plugins and ensure they are saved to our list of development dependencies, like so:
npm install --save-dev gulp-uglify gulp-jshint jshint
Note
You may have noticed that we're installing the jshint
module alongside the gulp-jshint
plugin. While we wont, be directly referencing this inside of our gulpfile
, it is important to note that it...