-----------------------------------------------------------------------------
-- |
-- Module : Static.Resources.Import
-- Copyright : (c) Scrive 2012
-- License : BSD-style (see the LICENSE file in the distribution)
--
-- Maintainer : mariusz@scrive.com
-- Stability : development
-- Portability : portable
--
-- Generating list of imports to be embedded in html
--
module Static.Resources.Import (
-- * Importing
htmlImportList
) where
import Static.Resources.Types
import Data.List
-- | Generating import list for HTML resources
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 -> "\n"
importListForCss :: ResourceSetForImport -> String
importListForCss rs = concatMap cssGen (cssFiles rs)
where cssGen fn = "\n"
importListForJS :: ResourceSetForImport -> String
importListForJS rs = concatMap jsGen (jsFiles rs)
where jsGen fn = "\n"
importListForLess :: ResourceSetForImport -> String
importListForLess rs = concatMap gen (lessFiles rs)
where gen fn = "\n"