diff --git a/src/Settings/StaticFiles/Generator.hs b/src/Settings/StaticFiles/Generator.hs index 6b4573631..b60bcef2c 100644 --- a/src/Settings/StaticFiles/Generator.hs +++ b/src/Settings/StaticFiles/Generator.hs @@ -19,6 +19,7 @@ import qualified Data.ByteString.Lazy as LBS import qualified Data.Map as Map import qualified Text.Sass.Compilation as Sass +import Text.Sass.Options import Data.Default @@ -44,15 +45,22 @@ compile :: MimeType -> Location -- ^ Relative location -> FilePath -- ^ Absolute filepath -> IO [Entry] -compile sassMime sassLoc fp - | sassMime `elem` [ "text/x-sass", "text/x-scss" ] - = return . pure $ def - { ebHaskellName = Just $ pathToName sassLoc - , ebLocation - , ebMimeType = "text/css" - , ebProductionContent = either (fail <=< Sass.errorMessage) (return . LBS.fromStrict) =<< Sass.compileFile fp def - , ebDevelReload = [| either (fail <=< Sass.errorMessage) (return . LBS.fromStrict) =<< Sass.compileFile $(litE $ stringL fp) def |] - } +compile "text/x-scss" sassLoc fp = return . pure $ def + { ebHaskellName = Just $ pathToName sassLoc + , ebLocation + , ebMimeType = "text/css" + , ebProductionContent = either (fail <=< Sass.errorMessage) (return . LBS.fromStrict) =<< Sass.compileFile fp def + , ebDevelReload = [| either (fail <=< Sass.errorMessage) (return . LBS.fromStrict) =<< Sass.compileFile $(litE $ stringL fp) def |] + } + where + ebLocation = sassLoc -<.> "css" +compile "text/x-sass" sassLoc fp = return . pure $ def + { ebHaskellName = Just $ pathToName sassLoc + , ebLocation + , ebMimeType = "text/css" + , ebProductionContent = either (fail <=< Sass.errorMessage) (return . LBS.fromStrict) =<< Sass.compileFile fp (def { sassIsIndentedSyntax = True }) + , ebDevelReload = [| either (fail <=< Sass.errorMessage) (return . LBS.fromStrict) =<< Sass.compileFile $(litE $ stringL fp) (def { sassIsIndentedSyntax = True }) |] + } where ebLocation = sassLoc -<.> "css" compile ebMimeType ebLocation fp = return . pure $ def