0

I'm looking for a package manager that can be added as a task in grunt that will download the latest version (maybe even a specific version ie: jquery v1.10 vs v2) of a library or js or css file and place it in a specific folder. Here is what I'm looking for:

  1. Run grunt task that will download the latest version of jQuery UI (js and css).
  2. Move the latest JS version of jQuery UI into assets/js and name the file jquery-ui.js
  3. Move the latest CSS version of jQuery UI of no-theme into assets/css and name the file jquery-ui.css

Another example would be:

  1. Run grunt task that will download the file at http://domain.com/css/grid.css.
  2. Move that file to assets/css and name the file grid.css.

Lastly, I'd like a way to do an update that will allow me to update all scripts or css files that I specify, so it knows which files to try to update. Also, I'd prefer if the package manager didn't clutter the repo with many additional files.

Does something like this exist? I've looked into Bower and Jam, but I'm not seeing this ability.

wwwuser
  • 6,282
  • 8
  • 52
  • 64
  • most package managers will use their own registry to download most commonly used packages, i don't think they let you specify where you want to download them. I think you're better off just building a simple script with grunt to handle those package updates, it should be simple enough. – mfreitas Jun 01 '13 at 20:31
  • That's what I'm thinking of doing, but I just want to make sure I'm not building something that has already been done. – wwwuser Jun 01 '13 at 20:46
  • I recently evaluated several package managers for JavaScript myself. Requirements were that it works for well-known and not so well-known (e.g. some little scripts on GitHub) projects and that it allows us to specify which files we actually wanted. However, I was not able to find something that suited our needs. Either it would require some kind of manifest file in the project to work, or it would just download to whole repository and not just the needed files. As far as I know, there is currently not one good, standard solution for this problem. – str Jun 01 '13 at 21:46

2 Answers2

0

Bower does indeed let you specify download url's for your packages.

From the bower.io site:

# Using a local or remote package 
bower install <package>

Where <package> can be any one of the following:

....
A URL to a file, including zip and tar.gz files. It's contents will be extracted.

Then you should just run bower update whenever you need to update things. Obviously you should use a CDN of sorts to automagically get links to the latest versions of the files you need.

Bower's .bowerrc file should let you specify the installation directory for your components. Keep in mind that this will have to be project specific.

It does create and rename files it manages on its own way, but that's a good thing. Specially because it exposes a very nice API for you to use.

mfreitas
  • 2,395
  • 3
  • 29
  • 42
0

Solved this by using grunt-curl.

https://github.com/twolfson/grunt-curl

wwwuser
  • 6,282
  • 8
  • 52
  • 64