在视觉工作室中,我有以下客户端项目结构
-wwwroot
-app
-js
-views
-css
-images
-lib
index.html
使用 gulp-inject 我想在 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>
我怎样才能做到这一点?