1
在Visual Studio中我有以下客戶端項目struture杯和注入路徑
-wwwroot
-app
-js
-views
-css
-images
-lib
index.html
隨着一飲而盡,注入我想我注入中的index.html內的JavaScript的路徑:
gulp.task('injecttest', function() {
var target = gulp.src('wwwroot/index.html');
var sources = gulp.src(['wwwroot/app/js/**/*.js'], { read: false });
return target.pipe(inject(sources)).pipe(gulp.dest('wwwroot/'));;
});
gulpfile.js位於wwwroot目錄之外。 這裏的問題是,我的index.html裏面,在形式注入的:
<script src="/wwwroot/app/js/RemoteCallServices.js"></script>
和工作,我需要有
<script src="app/js/RemoteCallServices.js"></script>
我怎樣才能做到這一點?
這對我的作品,而不是但如果'SRC = 「應用程序/ JS /等等......」 我''得到SRC =「/應用程序/ JS /等等......「'。任何想法如何刪除額外的領先'/'? – tengen
從ignorePath屬性中刪除額外的前導'/'。使用上面的例子,'{ignorePath:'wwwrooot /'}' – grimurd
更新:在[這個線程](https://github.com/klei/gulp-inject/issues/28)我看到我可以使用'addRootSlash :false'以及'ignorePath:'/ wwwrooot /''。爲我修好了。 – tengen