wiledal / gulp-include

Enables functionality similar to that of snockets / sprockets or other file insertion compilation tools.
157 stars 68 forks source link

Arrays no longer works ! #50

Closed bdecarne closed 8 years ago

bdecarne commented 9 years ago

Hi,

First i love your library, i use it in all my angular projects.

With the version 2.x it seems that arrays doesnt work anymore :

//=include ["*.js", "!app.js"] 

Can you confirm ? I would be sad...

wiledal commented 9 years ago

I actually have never seen this before... Are you certain this worked in 1.x?

gulp-include uses straight up glob, so anything glob can do, we can do. For this specific situation, you could use something like

//=include !(app.js)
bdecarne commented 9 years ago

Hi,

Yes, it worked on 1.x.

Look at this code extracted from the 1.1.1 version (https://github.com/wiledal/gulp-include/blob/3b174d93ea8caf69dacd6562c055d0090b435719/index.js#L99-L110) :

if (relativeFilePath.charAt(0) === '[') {
    relativeFilePath = eval(relativeFilePath);
    for (var i = 0; i < relativeFilePath.length; i++) {
        if (relativeFilePath[i].charAt(0) === '!') {
            negations.push(relativeFilePath[i].slice(1))
        } else {
            globs.push(relativeFilePath[i]);
        }
    }
} else {
    globs.push(relativeFilePath);
}

Blaise