question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't remove beginning of injected path using 'IgnorePath'

See original GitHub issue

I’m trying to have gulp-inject, inject a bunch of JS files in my app.

My folder structure looks like this

gulpfile.js
app/
    scripts/
    index.html

The file comments that get injected look like this. <script src="/app/scripts/app.js"></script>

However I need to remove the /app/ so the index.html file loads the .js files properly. I’ve tried adding this {ignorePath: 'app'} but it doesn’t seem to remove it from the inject comments.

Any ideas?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:35 (5 by maintainers)

github_iconTop GitHub Comments

25reactions
r4fxcommented, Jun 11, 2014

This works for me:

var paths = {
    html: ['doc/_src/**/*.html', '!doc/_src/_partials/*.html'],
    scripts: 'doc/js/**/*.js',
    styles: 'doc/styles/css/*.css',
    out: 'doc/'
};

gulp.task('inject', function () {
    gulp.src(paths.html)
        .pipe(inject(gulp.src([paths.styles], {read: false}),
            // Options
            {
                ignorePath: 'doc',
                addRootSlash: false
            }
        ))
        .pipe(gulp.dest(paths.out));
});
5reactions
Camusenseicommented, May 20, 2014

oh, and you will also need to use inject’s {addRootSlash: false}.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove path prefix in gulp injected script paths?
By setting ignorePath in gulp.file.js with src/main/resources/static it will removes the prefix path in index.html.
Read more >
gulp-inject - npm
Start using gulp-inject in your project by running `npm i gulp-inject`. ... By default the injected file paths are relative to each source ......
Read more >
Contexts and Dependency Injection - Quarkus
A typical example is a bean injecting a portable extension. In such case, it's possible to exclude types and dependencies from the bean...
Read more >
How I solved and debugged my Webpack issue through trial ...
My debugging journey started with the following setup: webpack.config.js ... const path = require('path');const HtmlWebpackPlugin ...
Read more >
Uninstall Pop-up Ads program from your computer
This page is a comprehensive guide, which will remove Pop-up Ads from Internet Explorer,. Firefox and Google Chrome. Please perform all the steps...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found