yesod-1.6.2.1: Creation of type-safe, RESTful web applications.

Safe Haskell | None
Language | Haskell2010

Yesod.Default.Util

Description

Various utilities used in the scaffolded site.

Synopsis

- addStaticContentExternal :: (ByteString -> Either a ByteString) -> (ByteString -> String) -> FilePath -> ([Text] -> Route master) -> Text -> Text -> ByteString -> HandlerFor master (Maybe (Either Text (Route master, [(Text, Text)])))
- globFile :: String -> String -> FilePath
- globFilePackage :: String -> String -> Q FilePath
- widgetFileNoReload :: WidgetFileSettings -> FilePath -> Q Exp
- widgetFileReload :: WidgetFileSettings -> FilePath -> Q Exp
- data TemplateLanguage = TemplateLanguage {
  - tlRequiresToWidget :: Bool
  - tlExtension :: String
  - tlNoReload :: FilePath -> Q Exp
  - tlReload :: FilePath -> Q Exp
  }
- defaultTemplateLanguages :: HamletSettings -> [TemplateLanguage]
- data WidgetFileSettings
- wfsLanguages :: WidgetFileSettings -> HamletSettings -> [TemplateLanguage]
- wfsHamletSettings :: WidgetFileSettings -> HamletSettings

# Documentation

addStaticContentExternal Source #

Arguments

:: (ByteString -> Either a ByteString) | javascript minifier
-> (ByteString -> String) | hash function to determine file name
-> FilePath | location of static directory. files will be placed within a "tmp" subfolder
-> ([Text] -> Route master) | route constructor, taking a list of pieces
-> Text | filename extension
-> Text | mime type
-> ByteString | file contents
-> HandlerFor master (Maybe (Either Text (Route master, [(Text, Text)]))) |

An implementation of `addStaticContent` which stores the contents in an external file. Files are created in the given static folder with names based on a hash of their content. This allows expiration dates to be set far in the future without worry of users receiving stale content.

globFile :: String -> String -> FilePath Source #

expects a file extension for each type, e.g: hamlet lucius julius

globFilePackage :: String -> String -> Q FilePath Source #

`globFile` but returned path is absolute and within the package the Q Exp is evaluated @since 1.6.1.0

widgetFileNoReload :: WidgetFileSettings -> FilePath -> Q Exp Source #

widgetFileReload :: WidgetFileSettings -> FilePath -> Q Exp Source #

data TemplateLanguage Source #

Constructors

TemplateLanguage |

Fields

- tlRequiresToWidget :: Bool
- tlExtension :: String
- tlNoReload :: FilePath -> Q Exp
- tlReload :: FilePath -> Q Exp

defaultTemplateLanguages :: HamletSettings -> [TemplateLanguage] Source #

data WidgetFileSettings Source #

#### Instances

Instances details

Default WidgetFileSettings Source # |
Instance details Defined in Yesod.Default.Util Methods def :: WidgetFileSettings #

wfsLanguages :: WidgetFileSettings -> HamletSettings -> [TemplateLanguage] Source #

wfsHamletSettings :: WidgetFileSettings -> HamletSettings Source #