module Static.Resources.Import (
htmlImportList
) where
import Static.Resources.Types
import Data.List
htmlImportList :: String -> ResourceSetsForImport -> String
htmlImportList s (ResourceSetsForImport rss _) =
case find (\r -> (name $ set r) == s) rss of
Just rs -> unlines [importListForCss rs
,importListForLess rs
,importListForJS rs]
Nothing -> "<!-- Resource set " ++ s ++ " is missing -->\n"
importListForCss :: ResourceSetForImport -> String
importListForCss rs = concatMap cssGen (cssFiles rs)
where cssGen fn = "<link rel='stylesheet' type='text/css' href='"++fn++"' media='screen'/>\n"
importListForJS :: ResourceSetForImport -> String
importListForJS rs = concatMap jsGen (jsFiles rs)
where jsGen fn = "<script src='"++fn++"' type='text/javascript'></script>\n"
importListForLess :: ResourceSetForImport -> String
importListForLess rs = concatMap gen (lessFiles rs)
where gen fn = "<link rel='stylesheet' type='text/css' href='"++fn++"' media='screen'/>\n"