Man: Let's go ahead and set up a clean task so that we can make sure our build directory is clean every time we run a new build.
Every time we run the build, we need to know that the build directory was empty when the build started. We don't want any leftover artifacts from previous builds in the build directory. The clean task will help us take care of that.
Let's go ahead and start out our set up by installing the clean task. We'll say, "mpm install Grunt-contrib-clean," we'll use the save dev that will save it to our package.json.
Once that's installed, we go ahead and load it over here by putting clean here and now, we're ready to go. Clean is super simple to configure.
We'll add a clean section. We'll give it a target called, "build." You'll need to give it a string. So, in this case, I want it to clean out the build directory. Let's go ahead and hit save.
Now, if we type, grunt clean and we tell it to just run the build target, it will go ahead and run. When we look up here, our build directory is gone.
By using clean, we'll make sure that our build directory is clean every single time we run a build so that we don't end up with stale artifacts.
From the terminal you type, "grunt build." It will run all three.
When we are done, we're finished with others. If we look up here, we have a build directory with our new app.js that's minified.