1

How do I filter out an entire folder from the main-bower-files?

For example, if I'm doing this mainBowerFiles('**/jquery-validation/**'), it returns only the files from the jquery-validation folder, but I need the opposite.

I've tried mainBowerFiles('!**/jquery-validation/**'), however it seems like ! sign doesn't work in this case. What's wrong with my pattern?

Zabavsky
  • 13,340
  • 8
  • 54
  • 79
  • 1
    You should read this thread - http://stackoverflow.com/questions/28749749/gulp-main-bower-files-regular-expression-filter-not-working – Lukasz Ciesluk Jan 02 '16 at 15:06

2 Answers2

5

It is possible to ignore Bower Packages getting picked up by mainBowerFiles with adding overrides: PACKAGE_NAME to bower.json

{
    "name": "My Project",
    "description": "",
    ...
    ...
    ...
    "dependencies": {
        ...
        ...
        ...
    },
    "overrides": {
        "PACKAGE_NAME": {
            "ignore": true
        }
    }
}

https://github.com/ck86/main-bower-files#ignore

superfly
  • 693
  • 7
  • 13
2

I solved this using filter function:

var ignoreJs = ['jquery-validation', ...];

// filter function
function mainBowerFilesFilter(filePath) {
    for (var i = 0; i < ignoreJs.length; i++) {
        if (filePath.indexOf(ignoreJs[i]) !== -1)
            return false;
    }
    return true;
}

// how to use
mainBowerFiles({ filter: mainBowerFilesFilter })
Zabavsky
  • 13,340
  • 8
  • 54
  • 79