Todd Wolfson

Software Engineer

January 19, 2014

For small projects, a high level dependency solution (e.g. bower, component) can take up more time than it's worth. As a result, I opt for a combination of grunt tasks that download and extract my dependencies.

Benefits to this approach include:

  • No opt-in support required from repositories
  • Keep record of where dependencies came from
  • Manage sets of options for compiled libraries (e.g. highlightjs)
  • Blends in to normal grunt workflow

Below is a stripped down set of what is used for

  curl: {
    // Micro libraries via
    'public/js/ready.js': '',
    'public/js/gator.js': '',
    'public/js/gator-legacy.js': '',

    // Example of complex flags
    highlight: {
      dest: 'tmp/',
      src: {
        url: '',
        method: 'post',
        form: {'bash.js': 'on', 'css.js': 'on'/*, ... */}
  unzip: {
    highlight: {
      src: 'tmp/',
      dest: 'tmp/highlight'
  copy: {
    'public/css/base/highlight.scss': 'tmp/highlight/styles/github.css',
    'public/js/highlight.js': 'tmp/highlight/highlight.pack.js'

// Combine all actions into a single task
grunt.registerTask('install', ['curl', 'unzip', 'copy']);

Running grunt install yields:

Running "curl:public/js/ready.js" (curl) task
File "public/js/ready.js" created.

Running "curl:public/js/gator.js" (curl) task
File "public/js/gator.js" created.

Running "curl:public/js/gator-legacy.js" (curl) task
File "public/js/gator-legacy.js" created.

Running "unzip:highlight" (unzip) task
File "tmp/highlight" created.

Running "copy:public/css/base/highlight.scss" (copy) task
Copied 1 files

Running "copy:public/js/highlight.js" (copy) task
Copied 1 files

Done, without errors.

The tasks used above were:

This was originally inspired by Bootstrap's customize feature. I wanted a solution to download a compiled custom flavor of Bootstrap.

The original proof of concept downloaded the uncustomized version and can be found at:

Top articles

Lessons of a startup engineer

Lessons from being a 3x first engineer, former Uber engineer, and working at even more startups

Develop faster

Removing the tedium from creating, developing, and publishing repos.

Sexy bash prompt

A bash prompt with colors, git statuses, and git branches.