Closed kzar closed 10 years ago
Yes, you're right - it does try to load in the root directory. Add some more meat to your regexp to avoid this for now. I use #"\.md$"
for instance.
Oh I see. Well the thing is I was trying to mimic how my site used to work with Jekyll; all files (static or not) in a directory, ones that start with YAML front matter get processed and ones without just get copied across. That's why I used the #".*" regexp, I was planning on manually processing the YAML stuff.
I guess maybe I'm better making my own slurp-directory type function?
You can solve your issue by just using a generic regex that doesn't match folders, like #"[^.]+\.[^.]+"
I'd say the better solution is to:
Say if I were to do it that way, I could have a slurp-directory regexp to match files possibly needing processing, filter the list down myself to get only the right files, process them and have stasis output them correctly I think. But could I then tell optimus to copy all files but the processed ones?
They are just maps, so you could merge the processed ones over the non-processed afterwards.
OK thanks I'll have a go at doing it the way you suggested. Thanks for the help
What if I want to map the directories to the root? e.g.
slurp-directory "resourcses/md" .....
{"/", "....."}
How can I accomplish this with REGEX?
@karneaud I'm not sure I understand what you're trying to accomplish. Please expand you explanation in a new issue.
@magnars
Sorry this should have been on @cjohansen repo. My bad.
its ok I was trying to build md files into the "/" of the build directory rather than "/dir/". I accomplished this task by changing the regex.
Works the way I want to now
slurp-directory seems to be attempting to slurp the root directory and therefore returning a FileNotFoundException. I guess the solution would be to filter away directories before slurping?
public/
directory inside my project. (Not in the resources directory.)(file-seq (clojure.java.io/file "public/"))
works fine(stasis.core/slurp-directory "public/" #".*")
returns "FileNotFoundException public java.io.FileInputStream.open (FileInputStream.java:-2)"(slurp (first (file-seq (clojure.java.io/file "public/"))))
also returns the same exception which could be a clue?(Perhaps the exception is caused by something else, I'm not best person to say.)
Cheers, Dave.