taptapship / wiredep

Wire Bower dependencies to your source code.
MIT License
1.15k stars 142 forks source link

cwd help #257

Open davidrhoderick opened 7 years ago

davidrhoderick commented 7 years ago

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?