Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data AssetError
- data PPReader = PPReader {}
- newtype PPM a = PPM {}
- runPPM :: PPM a -> PPReader -> IO a
- data PP = PP {
- ppName :: Text
- ppConsumes :: Text
- ppProduces :: Text
- ppAction :: PPAction
- type PPAction = ByteString -> PPM (Either CompileError ByteString)
- type CompileError = ByteString
- newtype PPs = PPs {}
- emptyPPs :: PPs
- lookupPP :: Text -> PPs -> Maybe PP
- insertPP :: PP -> PPs -> PPs
- fromList :: [PP] -> PPs
- data BuildSpec = BuildSpec {
- bsSourcePath :: FilePath
- bsDestPath :: FilePath
- bsPP :: Maybe PP
- type BuildMapping = [BuildSpec]
- data Herringbone = Herringbone {}
- data HerringboneSettings = HerringboneSettings {}
- type ConfigBuilder = HerringboneSettings -> HerringboneSettings
- hbSourceDir :: Herringbone -> FilePath
- hbDestDir :: Herringbone -> FilePath
- hbPPs :: Herringbone -> PPs
- hbVerbose :: Herringbone -> Bool
- verbosePut :: Herringbone -> String -> IO ()
- newtype LogicalPath = LogicalPath {
- fromLogicalPath :: [Text]
- makeLogicalPath :: [Text] -> Maybe LogicalPath
- unsafeMakeLogicalPath :: [Text] -> LogicalPath
- toFilePath :: LogicalPath -> FilePath
- data Asset = Asset {}
- assetContent :: Asset -> IO ByteString
Documentation
data AssetError Source
A value describing an error that occurred while trying to produce an
Asset
.
Data which is given to preprocessors on the off-chance that they need it (eg, Fay)
PPReader | |
|
A monad in which preprocessor actions happen.
A preprocessor something which is run on the asset before it is served. Preprocessors are run when a file matches its rule. For example, if you have a preprocessor which takes "coffee" files and emits "js" files, there is a file named "application.coffee", and you request "application.js", Herringbone will run the coffee preprocessor on "application.coffee" and serve you the result.
PP | |
|
= ByteString | Input file contents |
-> PPM (Either CompileError ByteString) | Output file contents, or a compile error. |
A function which performs the compilation.
type CompileError = ByteString Source
A string which should contain information about why an asset failed to compile.
A collection of preprocessors. This can store many preprocessors which produce files with the same extension, but may not store more than one preprocessor which consumes files of a particular extension.
lookupPP :: Text -> PPs -> Maybe PP Source
Given a file extension, find the preprocessor (if any) which consumes it.
insertPP :: PP -> PPs -> PPs Source
Inserts a preprocessor into a PPs. If a preprocessor already exists with the given extension, it is discarded.
A BuildSpec specifies how an asset should be built.
BuildSpec | |
|
type BuildMapping = [BuildSpec] Source
A BuildMapping contains the information to build all of the assets Herringbone is aware of.
data Herringbone Source
The 'main' datatype in this library. All of the important functions
will take a Herringbone
as their first argument.
data HerringboneSettings Source
Contains configuration.
HerringboneSettings | |
|
hbSourceDir :: Herringbone -> FilePath Source
The directory where Herringbone will look when searching for assets.
hbDestDir :: Herringbone -> FilePath Source
The directory to place assets in after compilation.
hbPPs :: Herringbone -> PPs Source
The collection of preprocessors that will be used when preprocessing assets.
hbVerbose :: Herringbone -> Bool Source
True iff the Herringbone
has the verbose setting enabled.
verbosePut :: Herringbone -> String -> IO () Source
Log a message to stdout if hbVerbose is enabled.
newtype LogicalPath Source
All assets in Herringbone are referenced by their logical path. This is the path to an asset, relative to the source directory.
makeLogicalPath :: [Text] -> Maybe LogicalPath Source
Create a LogicalPath from a list of path segments. For example,
["data", "dogs.txt"]
would map to data/dogs.txt (relative to the
source directory). This returns Nothing if the path would be unsafe (that
is, if it contains ".."), to prevent directory traversal attacks.
unsafeMakeLogicalPath :: [Text] -> LogicalPath Source
Create a LogicalPath without checking any of the values.
toFilePath :: LogicalPath -> FilePath Source
A preprocessed asset. Any function that returns this will already have done the preprocessing (if necessary).
Asset | |
|
assetContent :: Asset -> IO ByteString Source