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

Safe HaskellNone
LanguageHaskell2010

Web.Herringbone.Internal.BuildAsset

Description

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

Synopsis

Documentation

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 Bool Source

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.

compileAsset Source

Arguments

:: 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