Discussion:
[hakyll] Ignoring directories
g***@gmail.com
2015-08-19 16:37:23 UTC
Permalink
Hello,

I have a huge directory which I don't want the resource provider to
process. Could I use the ignoreFile mechanism to skip this directory? How?
My elementary attempt at ignoring the work2 directory is not working.

-- Custom configuration

myConfiguration :: Configuration
myConfiguration = defaultConfiguration {ignoreFile = ignoreFile'}
where
ignoreFile' path
| path == "work2" = False
| otherwise = ignoreFile defaultConfiguration path


ganesh
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Kyle Marek-Spartz
2015-08-20 21:17:26 UTC
Permalink
Hello,

Since ignoreFile' takes a path, you can do quite a bit with it!

All of these functions should be usable if you import them:

https://hackage.haskell.org/package/filepath-1.4.0.0/docs/System-FilePath-Posix.html

In my site.hs I import System.FilePath's takeFileName:

https://github.com/zeckalpha/kyle.marek-spartz.org/blob/master/site.hs#L11

And then I use it in my ignoreFile':

https://github.com/zeckalpha/kyle.marek-spartz.org/blob/master/site.hs#L252L261

I think if you use takeDirectory, and Data.List's isPrefixOf, that
should work.

https://hackage.haskell.org/package/filepath-1.4.0.0/docs/System-FilePath-Posix.html#v:takeDirectory

https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-List.html#v:isPrefixOf

Something like this:

ignoreFile' path
| "/directorytoignore" `isPrefixOf` takeDirectory path = True
| ...
Post by g***@gmail.com
Hello,
I have a huge directory which I don't want the resource provider to
process. Could I use the ignoreFile mechanism to skip this directory? How?
My elementary attempt at ignoring the work2 directory is not working.
-- Custom configuration
myConfiguration :: Configuration
myConfiguration = defaultConfiguration {ignoreFile = ignoreFile'}
where
ignoreFile' path
| path == "work2" = False
| otherwise = ignoreFile defaultConfiguration path
ganesh
--
Kyle Marek-Spartz
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ganesh Vijayakumar
2015-08-24 14:39:40 UTC
Permalink
Thanks very much for the suggestion. I just tried this..

-- Custom configuration

myConfiguration :: Configuration
myConfiguration = defaultConfiguration {ignoreFile = ignoreFile'}
where
ignoreFile' path
| "/work2" `isPrefixOf` takeDirectory path = True
| otherwise = ignoreFile defaultConfiguration path



Running ./site build or ./site watch still takes way too much time when
that huge directory is linked to /work2. Otherwise the site builds in less
than a second?

Will this ignoreFile mechanism still go through every file and apply the
rule to that file or will it completely ignore all subdirectories under
that prefix automatically.

If not this, could I alter the "providerDirectory" configuration to only
include a specific set of directories (basically all but this big one)?

ganesh

ganesh
Post by g***@gmail.com
Hello,
Since ignoreFile' takes a path, you can do quite a bit with it!
https://hackage.haskell.org/package/filepath-1.4.0.0/docs/System-FilePath-Posix.html
https://github.com/zeckalpha/kyle.marek-spartz.org/blob/master/site.hs#L11
https://github.com/zeckalpha/kyle.marek-spartz.org/blob/master/site.hs#L252L261
I think if you use takeDirectory, and Data.List's isPrefixOf, that
should work.
https://hackage.haskell.org/package/filepath-1.4.0.0/docs/System-FilePath-Posix.html#v:takeDirectory
https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-List.html#v:isPrefixOf
ignoreFile' path
| "/directorytoignore" `isPrefixOf` takeDirectory path = True
| ...
Post by g***@gmail.com
Hello,
I have a huge directory which I don't want the resource provider to
process. Could I use the ignoreFile mechanism to skip this directory?
How?
Post by g***@gmail.com
My elementary attempt at ignoring the work2 directory is not working.
-- Custom configuration
myConfiguration :: Configuration
myConfiguration = defaultConfiguration {ignoreFile = ignoreFile'}
where
ignoreFile' path
| path == "work2" = False
| otherwise = ignoreFile defaultConfiguration path
ganesh
--
Kyle Marek-Spartz
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...