Portability | portable |
---|---|
Stability | development |
Maintainer | mariusz@scrive.com |
Safe Haskell | Safe-Infered |
Put resources.spec into your public HTTP directory. List there your css and js files. Devide them over some sets.
Sample resources.spec:
set mainPage css mainPage.css js mainPage.js js jQuery.js
Usage:
do rs <- getResourceSetsForImport Development "public/resources.js" return "<html><head>"++(htmlImportList "mainPage" rs)++"</head><body/></html>"
- htmlImportList :: String -> ResourceSetsForImport -> String
- getResourceSetsForImport :: ImportType -> FilePath -> IO (Either String ResourceSetsForImport)
- cleanResourceFiles :: ResourceSpec -> IO ()
- data ResourceSpec
- parseSpec :: FilePath -> IO ResourceSpec
- check :: ResourceSpec -> IO (Either String ())
- data ImportType
- newtype ResourceSetsForImport = ResourceSetsForImport [ResourceSetForImport]
- generateResources :: ImportType -> ResourceSpec -> IO ResourceSetsForImport
Main interface
htmlImportList :: String -> ResourceSetsForImport -> StringSource
Generating import list for HTML resources
getResourceSetsForImport :: ImportType -> FilePath -> IO (Either String ResourceSetsForImport)Source
Make ResourceSetsForImport
ready. It will generate agregated css and js files if needed.
It will change directory to one of spec file. It agregates will be placed there.
When done it will change back to the oryginal dir
cleanResourceFiles :: ResourceSpec -> IO ()Source
Cleans all files that could be created by this system based on spec. It requires current directory to be in specification file directory
Parsing specification
data ResourceSpec Source
ResourceSpec
is a list of ResourceSet
and list of files or directories that can be ignored by check
function.
Check if your spec file is compleate and consistent with FS
check :: ResourceSpec -> IO (Either String ())Source
Performs check. Left is error with some description. * Fails with css and js files avaible but not listed in spec. * Fails with css and js files that are in spec, but not avaible.
data ImportType Source
We can import resources for development (no joined, gziped or minified) or for production.
newtype ResourceSetsForImport Source
Set of ResourceSetForImport