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

Include regexes don’t supersede exclude in config #118

Open
PeterMedina opened this issue Feb 21, 2020 · 1 comment
Open

Include regexes don’t supersede exclude in config #118

PeterMedina opened this issue Feb 21, 2020 · 1 comment

Comments

@PeterMedina
Copy link
Contributor

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 to exclude: in _config.yml
  • I added /dist\/(css|fonts|images|js)\/.+/ to include: 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

  1. Create a folder called dist with sub-folders of css, images and include a CSS file and a few images into their respective folders
  2. Add dist to the excludes list in _config.yml
  3. Add /dist\/(css|images)\/.+/ to the includes list in _config.yml
  4. Build Stakx

The dist folder will not be included in the build.

@allejo
Copy link
Member

allejo commented Feb 21, 2020

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?

@allejo allejo changed the title Include doesn’t supersede exclude in config Include regexes don’t supersede exclude in config Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants