Recompressing for production

Keyboard Shortcuts

Building workflows is significantly different when you use npm. What you end up with is definitely smaller, but it does take a bit of practice to get things just right. There's nothing wrong with using a build tool like Grunt or Gulp, but even if you love those, enough applications come with built in npm scripts, so it's important to understand how they work because it might be the way that your team decides to work with their tooling.

- [Instructor] So, it's time to finish up,…and we need to do two more things in our production build.…First is to re-compress our Sass files for production,…and then also take care of our JavaScript files.…Plus, I'm going to add a serve command,…so that we can preview what we've done…one more time before we push.…So let's take a look at what we need to do here.…First, I'm going to use a copy of this Sass task…that I've specified for development right here.…Let's go ahead and copy that, and put it into production.…

So, it's actually easier not to add things at the end,…and this one doesn't have to be at the end.…So I'm going to paste that right here,…change this to production, and so,…it will get picked up as a result of this build command run.…And then I'm going to do, not a watch,…because I don't need it to watch any particular folders…for changes, and for the output styled,…I want the most compressed output style.…So that will be, of course, compressed.…

I am not going to need sourcemaps,…because this is production, so I don't really want…

Resume Transcript Auto-Scroll

Author

Released

9/29/2016

While Gulp, Grunt, and Bower are great tools, Node.js offers an alternative for implementing build processes: npm and your package.json file. npm (node package manager) is all about creating custom scripts for common development and production tasks. You can write npm scripts to process and compress code, create services, minify images, and automate all sorts of build tasks. This course shows you how. Join Ray Villalobos as he walks through the advantages—and few disadvantages—of working with npm scripts and the steps for scripting different development and build tasks. Even if you don't use npm for your own processes, many Node.js packages come with npm scripts built in. This is a great course to help you understand how they work.