Chapter 11. Deployment: assets and Heroku

 

This chapter covers

  • LESS for improving your CSS
  • Browserify for packaging JavaScript, letting you share code between client and server
  • connect-assets as an alternative to Grunt for compiling and serving CSS and JavaScript
  • Deploying your applications to Heroku for the real internet

It’s time to put your applications into the real world. The first part of this chapter will discuss assets. If you’re building any sort of website, it’s very likely that you’ll be serving both CSS and JavaScript. It’s common to concatenate and minify these assets for performance. It’s also common to code in languages that compile to CSS (like SASS and LESS), just as it’s common to code in languages that transpile to JavaScript (like CoffeeScript or TypeScript), or to concatenate and minify JavaScript. Debates quickly turn into flame wars when talking about things like this; should you use LESS or SASS? Is CoffeeScript a good thing? Whichever you choose, I’ll show you how to use a few of these tools to package up your assets for the web.

The rest of this chapter will show you how to build your Express applications and then put them online. There are lots of deployment options, but you’ll use one that’s easy and free to try: Heroku. You’ll add a few small things to your app and deploy an Express app into the wild.

After this chapter, you’ll

11.1. LESS, a more pleasant way to write CSS

11.2. Using Browserify to require modules in the browser

11.3. Using Grunt to compile, minify, and more

11.4. Using connect-assets to compile LESS and CoffeeScript

11.5. Deploying to Heroku

11.6. Summary