[英]Gulp using wiredep for bower dependencies: output different path
我正在使用Gulp和wiredep 。 我得到的輸出不是我的文件的正確路徑。 我想相應地更改該路徑的輸出。
當前路徑:
<script src="../bower_components/angular/angular.js"></script>
通緝結果:
<script src="./vendors/angular.js"></script>
目前的gulp任務:
gulp.task('index', function() {
var target = gulp.src(files.app_files.target);
var sources = gulp.src(files.app_files.sources, {
read: false
});
// {caseSensitive: true }
return target
.pipe(inject(sources, {
ignorePath: 'app'
}))
.pipe(wiredep())
.pipe(gulp.dest('dist'));
});
wiredep誕生於你的html中的wire bower依賴項。
無論如何,你可以像這樣設置一個programmatica訪問js
Programmatic Access
You can run wiredep without manipulating any files.
require('wiredep')();
...returns...
{
js: [
'paths/to/your/js/files.js',
'in/their/order/of/dependency.js'
],
css: [
'paths/to/your/css/files.css'
],
// etc.
}
你可以在文檔中找到
作為建議,在開發階段,使用bower_dependencies作為“repo”並沒有錯。 在構建階段,當您准備生產環境時,可以將useref與wiredep結合使用,然后將構建的文件移動到您想要的位置
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.