this is my project
- Project root
|- build
|-css
|-js
|-index.html
|- src
|- css
|- js
|-index.html
|-gulpfile.js
I use gulp and want to inject build/scc and build/js files into src/index.html and place it as build/index.html
Done this :
gulp.task('index', function () {
var target = gulp.src('src/index.html');
var sources = gulp.src(['build/js/*.js', 'build/styles/*.css'], { ignorePath: 'build/', addRootSlash: false });
return target.pipe(inject(sources))
.pipe(gulp.dest('build'));
});
I need to skip the '/build/' part But still on output of html file shows :
<link rel="stylesheet" href="/build/styles/app.min.css">
<script src="/build/js/app.min.js"></script>
Now we are in
index.html
which is inbuild
directory(folder), we need to go a step backward to have access to thesrc
directory, and..
will be the parent directory of the current directory (meansbuild
)then you can use this:
Reading more about relative and absolute path will help you to learn more about this