Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Painless asset management with connect-assets @ NoVaNode

Painless asset management with connect-assets @ NoVaNode

connect-assets is a transparent asset management package for node.js: it compiles, concatenates, minifies, and fingerprints your JavaScript, CSS, fonts, images, and the like to ensure that your site always looks its best, even when you deploy updates to cached files.

As the maintainer of the package, I’ll give a bit of history on the module and talk about why you’d want something like connect-assets. We’ll go through the basics of properly serving assets and write (live-code?!) an Express application using connect-assets.

Andrew Dunkman

February 20, 2014
Tweet

More Decks by Andrew Dunkman

Other Decks in Technology

Transcript

  1. var express = require("express");! var app = express();! ! !

    ! app.listen(3000); app.use(require("connect-assets")());!
  2. Why should you use connect-assets? Your assets should leverage HTTP

    caching as much as possible. You shouldn’t need to clear browser caches, ever.
  3. Why should you use connect-assets? Your assets should leverage HTTP

    caching as much as possible. You shouldn’t need to clear browser caches, ever. Your assets should be easy to debug in development.
  4. Why should you use connect-assets? Your assets should leverage HTTP

    caching as much as possible. You shouldn’t need to clear browser caches, ever. Your assets should be easy to debug in development. You should optimize HTTP requests and file size in production.
  5. Why should you use connect-assets? Your assets should leverage HTTP

    caching as much as possible. You shouldn’t need to clear browser caches, ever. Your assets should be easy to debug in development. You should optimize HTTP requests and file size in production. You should be able to use the best language for the job. (SASS, Less, Stylus, CoffeeScript, TypeScript, etc)
  6. Why should you use connect-assets? Your assets should leverage HTTP

    caching as much as possible. You shouldn’t need to clear browser caches, ever. Your assets should be easy to debug in development. You should optimize HTTP requests and file size in production. You should be able to use the best language for the job. (SASS, Less, Stylus, CoffeeScript, TypeScript, etc) Choosing a language that compiles to CSS or JavaScript shouldn’t introduce extra build/development steps.
  7. Why should you use connect-assets? Your assets should leverage HTTP

    caching as much as possible. You shouldn’t need to clear browser caches, ever. Your assets should be easy to debug in development. You should optimize HTTP requests and file size in production. You should be able to use the best language for the job. (SASS, Less, Stylus, CoffeeScript, TypeScript, etc) Choosing a language that compiles to CSS or JavaScript shouldn’t introduce extra build/development steps. You shouldn’t need to write any code to do all of this.
  8. ?