static-resources-0.1.1: JavaScript and Css files concat for http optimization

Portabilityportable
Stabilitydevelopment
Maintainermariusz@scrive.com
Safe HaskellSafe-Infered

Static.Resources

Contents

Description

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

Synopsis

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.

Instances

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.

Constructors

Development 
Production 

Instances