stephenplusplus/grunt-wiredep

cwd help

Opened this issue · 3 comments

I posted this in wiredep but maybe it is more specific to grunt-wiredep:

So I'm trying to clean up my application structure by putting bower_components in a vendor folder like this:

project
|-app
||-vendor
|||-bower_components

Inside my vendor folder, I have the bower.json and the .bowerrc files, and I've installed all my dependencies. I'm basing my wiredep code off of an Angular Yeoman generator, so maybe I'm messing it up a bit but it looks like this now:

// Automatically inject Bower components into the app
    wiredep: {
      app: {
        bowerJson: require('./vendor/bower.json'),
        directory: './vendor/bower_components',
        cwd: 'vendor',
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath:  /\.\.\//
      },
      test: {
        bowerJson: require('./vendor/bower.json'),
        directory: './vendor/bower_components',
        cwd: 'vendor',
        devDependencies: true,
        src: '<%= karma.unit.configFile %>',
        ignorePath:  /\.\.\//,
        fileTypes:{
          js: {
            block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
              detect: {
                js: /'(.*\.js)'/gi
              },
              replace: {
                js: '\'{{filePath}}\','
              }
            }
          }
      },
      sass: {
        bowerJson: require('./vendor/bower.json'),
        directory: './vendor/bower_components',
        cwd: 'vendor',
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }
    },

I added some configuration so that the bower.json and .bowerrc files would be found correctly inside the vendor folder because that was stopping grunt from running, but I'm now stuck on linking. When I run the serve task, which uses wiredep, the html is pointing to the vendor/bower_components/ folder for each dependency but not finding any of the files. I feel like maybe I messed something up, how do I fix this?

@davidrhoderick Did you ever get this working? I just tried using cwd for the first time and it appears to do nothing. I'm curious if it works for anyone else.

@SkydiverFL I haven't gotten it working yet. What version are you on? I'm using 2.0.0, but not much has changed regarding cwd usage.

@SkydiverFL any updates from your end?