maccman / catapult

A Sprockets/Rack build tool
MIT License
138 stars 14 forks source link

add fetcher to fetch JS dependencies #13

Closed mulderp closed 11 years ago

mulderp commented 11 years ago

This small class adds a feature to easily fetch JavaScript dependencies from their project pages, e.g.:

 bin/catapult fetch jquery

would 'fetch' jQuery and it could easily piped into your new project with '> assets/libs/...'

Currently supported fetches are:

  'jquery'       => 'http://code.jquery.com/jquery-1.9.1.js',
  'underscore'   => 'http://backbonejs.org/backbone.js',
  'backbone'     => 'http://underscorejs.org/underscore.js',
  'handlebars'   => 'https://raw.github.com/wycats/handlebars.js/1.0.0-rc.3/dist/handlebars.js',
  'marionette'   => 'http://marionettejs.com/downloads/backbone.marionette.js'

I can imagine some variations of the theme to help to setup a fresh project from scratch (e.g. using a YAML, automatically saving the files in the corresponding folders, etc.)

What do you think?

lucasmazza commented 11 years ago

Hey, have you tried to use something like Bower or Component to manage your JavaScript dependencies? They are a better fit for the job and aren't a fixed dependency on Catapult, but I believe that @maccman would like to Catapult to work seamless with one of those JS package managers.

mulderp commented 11 years ago

Thanks, yes, I've read about bower, but from my understanding it works with grund to download the deps (whole git repo's by default), see e.g. http://www.blogeek.com.ar/2013/04/25/automatically-download-use-frontend-js-dependencies-with-bower-grunt-boilerplate-free/

When I start with fiddling frontend apps, an easier bundler solution would be great. The approach here is only very rough, but could evolve into something better, e.g. reading dependencies from a file, ... ?

mulderp commented 11 years ago

Hmm.. I think bower solves indeed part of the problem that I had, nice writeup here: http://dev.af83.com/2013/01/02/managing-rails-assets-with-bower.html

So, we maybe would need to provide an empty component.json, or component.json templates, such that when we run

bower install

We are ready to go?

mulderp commented 11 years ago

Indeed, bower and bower-installer (https://github.com/blittle/bower-installer) are a great combination to fetch JavaScript dependencies. Probably, this PR can be closed.

mulderp commented 11 years ago

some thoughts here: http://thinkingonthinking.com/Preparing-Application-Development/