module Static.Resources.Types (
ResourceType(..)
, Resource(..)
, ResourceSet(..)
, ResourceSpec(..)
, ImportType(..)
, ResourceSetForImport(..)
, ResourceSetsForImport(..)
, filterByType
) where
import Data.Data
import Data.Time.Clock
data ResourceType =
CSS
| LESS
| JS
| JSX
deriving (Show, Data, Typeable, Eq)
data Resource = Resource {
rtype :: !ResourceType
, path :: !FilePath
} deriving Show
data ResourceSet = ResourceSet {
name :: !String
, resources :: ![Resource]
} deriving Show
data ResourceSpec = ResourceSpec {
sets :: ![ResourceSet]
, ignored :: ![FilePath]
} deriving Show
filterByType :: (ResourceType -> Bool) -> ResourceSet -> [Resource]
filterByType f = filter (\r -> f $ rtype r) . resources
data ImportType = Development | Production deriving Show
data ResourceSetForImport = ResourceSetForImport {
set :: !ResourceSet
, cssFiles :: ![FilePath]
, jsFiles :: ![FilePath]
, lessFiles :: ![FilePath]
} deriving Show
data ResourceSetsForImport = ResourceSetsForImport {
_sets :: [ResourceSetForImport]
, generationTime :: UTCTime
}