Include regexes don’t supersede exclude in config
Opened this issue · 1 comments
System Information
PHP Version:
7.4.1
stakx Version:
v0.2.0-beta1-19-g719042b
Operating System
macOS 10.15.2
Expected behavior
- I added
dist
toexclude:
in_config.yml
- I added
/dist\/(css|fonts|images|js)\/.+/
toinclude:
in_config.yml
I expected it to exclude everything in the dist
folder except for the files included in the includes regex
Actual behavior
The desired contents of the dist
folder were not copied over to the Stakx build; the dist
folder itself was not included.
Steps to reproduce behavior
- Create a folder called
dist
with sub-folders ofcss
,images
and include a CSS file and a few images into their respective folders - Add
dist
to theexcludes
list in_config.yml
- Add
/dist\/(css|images)\/.+/
to theincludes
list in_config.yml
- Build Stakx
The dist
folder will not be included in the build.
I've added a failing test in 4d5f46c.
The problem is that since FileExplorer
short circuits any time it finds an excluded directory, it will not traverse inside of it meaning any regular expressions defined in include
won't ever be matched. Explicit file paths in include
are just a "copy if exists" behavior and doesn't need to match things.
I'm not sure whether or not this should be fixed. If it is fixed, how should it be fixed without introducing performance issues? Should I add support for including folders and explicitly traversing those?