Skip to content

Using ? tags in addPrefix seems to drop all assets #156

@flovan

Description

@flovan

Hi,

I might have discovered a bug. I first thought it might be related to my personal setup, which has become rather big, but this small test-bed has the same results:

var gulp = require('gulp');
var inject = require('gulp-inject');

gulp.task('default', function (cb) {
    gulp.src('test/index.html')
        .pipe(inject(gulp.src(['test/*.{js,css}']), {
            addRootSlash: false,
            addPrefix: 'test'
        }))
        .pipe(gulp.dest('test/out/test-regularl'));

    gulp.src('test/index.html')
        .pipe(inject(gulp.src(['test/*.{js,css}']), {
            addRootSlash: false,
            addPrefix: '<?php echo stuff(); ?>'
        }))
        .pipe(gulp.dest('test/out/test-php'));

    cb(null);
});

Test HTML document:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <!-- inject:css --><!-- endinject -->
</head>
<body>
    <!-- inject:js --><!-- endinject -->
</body>
</html>

The first run will result in the files being injected as suspected, where the second run will not inject anything. Through trial & error, I managed to deduce that this problem occurs as soon as you insert a ? into the prefix string.

Edit; In case this might help:

OS X 10.11.1
node v4.1.2
gulp v3.9.0
gulp-inject v3.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions