herringbone-0.1.1: A library for compiling and serving static web assets.

Safe HaskellNone



This module contains functions to build assets (that is, run preprocessing if necessary, and copy to destination directory).



buildAsset :: Herringbone -> BuildSpec -> IO (Either AssetError Asset)Source

Build an asset based on a BuildSpec to produce a Asset. This action checks whether the compilation is necessary based on the modified times of the source and destination files.

shouldCompile :: Herringbone -> UTCTime -> FilePath -> IO BoolSource

Should we compile an asset? True if either the asset doesn't exist, or if its modified time is older than the supplied source modification time.



:: Herringbone 
-> FilePath

Source path

-> FilePath

Dest path

-> [PP]

List of preprocessors to apply

-> IO (Either CompileError ()) 

Compile the given asset by invoking any preprocessors on the source path, and copying the result to the destination path.

chainEither :: Monad m => [a -> m (Either b a)] -> a -> m (Either b a)Source