Javascript 如何使用wiredep获得正确的依赖项注入路径?

Javascript 如何使用wiredep获得正确的依赖项注入路径?,javascript,wiredep,Javascript,Wiredep,我正在尝试在我的应用程序中包含来自bower的css和js文件。我在app/rawHtml/index.html中有原始index.html(html exculding bower css和js),如下面的文件夹树所示: app ├── bower_components │   ├── lib1 │   │   ├── lib1.css │   │   ├── lib1.js │   │   ├── bower.json │   │   ├── packa

我正在尝试在我的应用程序中包含来自bower的css和js文件。我在
app/rawHtml/index.html
中有原始
index.html
(html exculding bower css和js),如下面的文件夹树所示:

 app
   ├── bower_components
   │   ├── lib1
   │   │   ├── lib1.css
   │   │   ├── lib1.js
   │   │   ├── bower.json
   │   │   ├── package.json
   │   │   └── README.md
   │   ├── lib2
   │   │   ├── lib2.css
   │   │   ├── lib2.js
   │   │   ├── bower.json
   │   │   ├── package.json
   │   │   └── README.md
   │   │       ├── globals.js
   │   │       ├── locale-header.js
   │   │       └── test-header.js
   ├── index.html
   └── rawHtml
       └── index.html
我想使用
app/rawHtml/index.html
app/index.html
。我的
wiredep
的gulpfile如下所示:

gulpfile.js

gulp.task('bower:dev', function () {
   return gulp.src('app/rawHtml/index.html')
   .pipe(wiredep())
   .pipe(gulp.dest('app/'));
});
 <!-- bower:css --> 
 <link rel="stylesheet" href="bower_components/lib1/lib1.css" />                                                             
 <link rel="stylesheet" href="bower_components/lib2/lib2.css" />

<!-- bower:js -->
<script src="bower_components/lib1/lib1.js"></script>
<script src="bower_components/lib2/lib2.js"></script>
现在创建index.html文件。但是对于
app/rawHtml/index.html
,依赖项注入如下:

 <!-- bower:css --> 
 <link rel="stylesheet" href="../bower_components/lib1/lib1.css" />                                                             
 <link rel="stylesheet" href="../bower_components/lib2/lib2.css" />

<!-- bower:js -->
<script src="../bower_components/lib1/lib1.js"></script>
<script src="../bower_components/lib2/lib2.js"></script>

我试图将源文件和目标文件
index.html
保存在同一个目录中,但没有找到重命名目标文件的选项。如何使用wiredep以获得正确的注入路径?

好的,我也遇到了同样的问题。我想在运行
wiredep
命令之前,您需要将
index.html
放在
app
dir中

gulpfile.js

gulp.task('bower:dev', function () {
    return gulp.src('app/rawHtml/index.html')
    .pipe(gulp.dest('app/'))
    .pipe(wiredep())
    .pipe(gulp.dest('app/'));
});

好吧,我也有同样的问题。我想在运行
wiredep
命令之前,您需要将
index.html
放在
app
dir中

gulpfile.js

gulp.task('bower:dev', function () {
    return gulp.src('app/rawHtml/index.html')
    .pipe(gulp.dest('app/'))
    .pipe(wiredep())
    .pipe(gulp.dest('app/'));
});