| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
SitePipe.Files
Contents
Synopsis
- resourceLoader :: (String -> IO String) -> [GlobPattern] -> SiteM [Value]
- writeWith :: ToJSON a => (a -> SiteM String) -> [a] -> SiteM ()
- writeTemplate :: ToJSON a => FilePath -> [a] -> SiteM ()
- textWriter :: ToJSON a => [a] -> SiteM ()
- copyFiles :: [GlobPattern] -> SiteM [Value]
- copyFilesWith :: (FilePath -> FilePath) -> [GlobPattern] -> SiteM [Value]
Loaders
Arguments
| :: (String -> IO String) | A reader which processes file contents |
| -> [GlobPattern] | File glob; relative to the |
| -> SiteM [Value] | Returns a list of Aeson objects |
Given a resource reader (see SitePipe.Readers)
this function finds all files matching any of the provided list
of fileglobs (according to srcGlob) and returns a list of loaded resources
as Aeson Values.
Writers
Arguments
| :: ToJSON a | |
| => (a -> SiteM String) | A function which renders a resource to a string. |
| -> [a] | List of resources to write |
| -> SiteM () |
Write a list of resources using the given processing function from a resource to a string.
Arguments
| :: ToJSON a | |
| => FilePath | Path to template (relative to site dir) |
| -> [a] | List of resources to write |
| -> SiteM () |
Given a path to a mustache template file (relative to your source directory); this writes a list of resources to the output directory by applying each one to the template.
Writes the content of the given resources without using a template.
Loader/Writers
copyFiles :: [GlobPattern] -> SiteM [Value] Source #
Given a list of file or directory globs (see srcGlob)
we copy matching files and directories as-is from the source directory
to the output directory maintaining their relative filepath.
For convenience this also returns a list of the files copied as
Values with "src" and "url" keys
which represent the source path and the url.of the copied file respectively.
copyFilesWith :: (FilePath -> FilePath) -> [GlobPattern] -> SiteM [Value] Source #