Reputation: 1723
I'm trying to figure out how to write an input filter that matches any file with a particular extension in a specified sub-directory. I cannot seem to get it to work.
More specifically, I want to include modules/*.styl
I'm having a heck of a time getting that pattern to work in my build.sbt
file I'm trying to do something like this:
includeFilter in (Assets, StylusKeys.stylus) := "modules" * "*.styl"
I haven't ben able to come up with anything that even will allow SBT to start up. Anyone have a clue?
I'm using SBT 0.13.5.
Upvotes: 3
Views: 1348
Reputation: 1828
First the includeFilter
key has type FileFilter
. Look this link to see how it is defined.
I think there is no easy way to do what you want since implicits from String
to FileFilter
produce only NameFilter
. Those only test the file name, not the path as you want to.
You can define your own FileFilter
based on the examples provided. The idea: you create one filter for the parent directory and then combine it with a PatternFilter
for the file name.
includeFilter in (Assets, StylusKeys.stylus) := new SimpleFileFilter(file => file.getParent == "modules") && "*.styl"
Of course you will perhaps have to modify the function passed to SimpleFileFilter
according to your needs.
Upvotes: 2