generator-angular
generator-angular copied to clipboard
Bower component links point to wrong directory
Hey,
After running the generator and visiting /app/ you get missing resources, because all bower components seem to be linked to
/app/bower_components/angular/angular.js /app/bower_components/... However, the generator directory structure is:
/app/ /bower_components/ Am I missing something here ?
I'm having this "issue" using Gulp, index.html script tags:
<script src="/bower_components/jquery/dist/jquery.js"></script>
<script src="/bower_components/angular/angular.js"></script>
In the other hand, if I manually copy the bower_components folder inside the app folder it works perfectly.
The same problem occurs using Grunt instead of Gulp.
Me too. I'm using Gulp though.
I am also joining my scream to this issue. I use Grunt and I have found the the root of the problem is on the wiredep configuration, by default it has this configuration:
// Automatically inject Bower components into the app
wiredep: {
app: {
src: ['<%= yeoman.app %>/index.html'],
ignorePath: /\.\.\//
},
test: {
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}}\','
}
}
}
}
},
I had to leave the relative path out of the configuration in order to wiredep to find the correct path. Once I have done with all the coding on app I added a dist configuration so that when I run the build task it catches the correct path.
// Automatically inject Bower components into the app
wiredep: {
app: {
src: ['<%= yeoman.app %>/index.html'],
exclude: ['/bower_components/html5shiv/dist/html5shiv.js']
},
dist: {
src: ['<%= yeoman.app %>/index.html'],
ignorePath: /\.\.\//,
exclude: ['/bower_components/html5shiv/dist/html5shiv.js']
},
test: {
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}}\','
}
}
}
}
},
Although this is not the best solution it has allow me to continue my work and finish the project I was working on.
The same problem. It looks like nobody wants to fix it. It's necessary to link wiredep and useref to correct path specified in .bowerrc.
Why are you visiting /app/
? The root url should not have the app part of it.