I am using grunt and I want to copy the bower dependencies when creating a production distribution
These dependencies already exist in. / components
I am creating a production directory with index.html inside and want to copy only the dependencies from the bower.json file.
I thought it would be as simple as generating a list from deps:
prodComponents = Object.keys(grunt.file.readJSON('./bower.json').dependencies)
(which is created using a simple console.log (prodComponents)
[ 'requirejs', 'requirejs-text', 'jquery', 'underscore-amd', 'backbone-amd', 'backbone.wreqr', 'backbone.babysitter', 'marionette' ]
and then just copy the appropriate files:
copy: deps: files: [ expand: true cwd: './components' src: ['./<%= prodComponents %>/*'] dest: './dev/components' ]
This works, but copies ALL components. i.e. my file error
Running "copy:deps" (copy) task Created 15 directories
if i delete. /, then crash:
Warning: Unable to read "components/Applications" file (Error code: ENOENT). Use --force to continue.
I can't help but think that I'm either trying to be too smart, or almost there with that.
What am I doing wrong with the file specification spec?
thanks