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

Safe HaskellNone
LanguageHaskell2010

Web.Herringbone.Internal.GetBuildMapping

Description

This module deals with locating assets on the disk, and determining which assets needs preprocessing.

In development mode: * At startup, build a mapping of source files to destination files together with any preprocessors that should be run on them (based on extension) * watch for filesystem changes, and rebuild relevant parts of this mapping when necessary * listen for HTTP requests and serve relevant files, performing preprocessing where necessary. (well, eventually do all that. For now just rebuild the BuildMapping for each request).

In production mode: * build the mapping * preprocess all the files and output them to a particular directory.

This architecture should ensure that the file mapping is identical in each mode.

Synopsis

Documentation

getBuildSpec :: Herringbone -> FilePath -> BuildSpec Source

Given a FilePath of a source file, construct a BuildSpec for the file.

makeDestAbsolute :: Herringbone -> BuildSpec -> IO BuildSpec Source

Make the destination path of a BuildSpec absolute, using the destination directory of the given Herringbone.

searchForFile Source

Arguments

:: [FilePath]

List of search paths

-> FilePath

File to search for

-> IO (Maybe FilePath) 

Search for a file in a list of search paths. For example, if assets/test.txt exists, then searchForFile ["assets", "other_assets"] "test.txt" will return Just "assets/text.txt"