Open ScottSmith95 opened 8 years ago
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.
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-kit
s options.
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.
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.
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.