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

Root directory files not found #18

Open
ScottSmith95 opened this issue Aug 30, 2016 · 4 comments
Open

Root directory files not found #18

ScottSmith95 opened this issue Aug 30, 2016 · 4 comments

Comments

@ScottSmith95
Copy link

I keep most of my kit partials in a folder in the root directory of my project. Currently, the only way to reference these files from a subdirectory is like so: ../kit-includes/foo.kit
I would hope there is a way to improve this so I can just specify the root path and gulp-kit picks up the files there (like so: /kit-includes/foo.kit).

I thought this was an issue with gulp-kit, but I've been reviewing the code here and it seems that the issue is likely here. I would be willing to submit a pull request, but I don't quite know how the file lookups work.

@fatso83
Copy link
Contributor

fatso83 commented Aug 30, 2016

The file lookups are simple enough. Give a string and it checks if the file is present. The root dir should not be of any concern. You can try using it as a cli tool if that's more convenient for verification.

@jeremyworboys
Copy link
Owner

The line @fatso83 linked is only for locating the starting file. The file lookup is handled by the Kit.prototype._findFile method.

It would be simple enough to add an optional parameter for import paths, which could then be exposed in gulp-kits options.

@ScottSmith95
Copy link
Author

That's what I thought. It seems line 369 is responsible for the relative file path finding, but maybe it doesn't work for root directories. This is where my knowledge kind of runs out.

@jeremyworboys
Copy link
Owner

The current findFile implementation only checks the following in this order:

Line Type Variant Example
372 absolute typed /home/username/example/kit-includes/foo.kit
373 relative typed ../kit-includes/foo.kit
374 absolute alternate /home/username/example/kit-includes/_foo.kit
375 relative alternate ../kit-includes/_foo.kit

Where relative is from the file declaring the import and absolute is from the filesystem root.

Where typed is the path that appears in the import declaration and alternate is either with or without an underscored filename.

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

3 participants