Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass function result as exclude list seems not working #86

Closed
weilinzung opened this issue Apr 20, 2019 · 1 comment
Closed

Pass function result as exclude list seems not working #86

weilinzung opened this issue Apr 20, 2019 · 1 comment

Comments

@weilinzung
Copy link

weilinzung commented Apr 20, 2019

Hi,

I have a function that creates a list to NOT delete, but del seems not working with the string that passes from the function.

Example:

function excludeList {
  ...
  fileNames
}

the output that already formatted as a string like this:
'!dist/images/1.png', '!dist/images/2.jpg', ...
––––

var excludeNames = ${fileNames};
console.log(excludeNames);
del(['dist/images/**', '!dist/images', ${excludeNames} ]);

So it will delete all the images also include the exclude ones.

Any ideas? thanks!

@kevva
Copy link
Contributor

kevva commented Sep 6, 2019

excludedNames should be an array, not a string.

await del(['dist/images/**', '!dist/images', ...excludedNames]);

@kevva kevva closed this as completed Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants