Created
September 24, 2012 06:34
-
-
Save KirinDave/3774612 to your computer and use it in GitHub Desktop.
Rewritten sass helper for hakyll.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings, QuasiQuotes #-} | |
module Helpers.SassCompiler (compressSassCompiler, sassCompiler) where | |
import qualified Data.ByteString.Char8 as B | |
import Control.Arrow ((>>>)) | |
import Data.Conduit | |
import Data.Conduit.Process | |
import System.Process.QQ | |
import Data.Conduit.List (consume) | |
import Hakyll | |
import Hakyll.Web.CompressCss (compressCss) | |
compressSassCompiler :: Compiler Resource String | |
compressSassCompiler = getIdentifier >>> (unsafeCompiler $ compressSassString) | |
sassCompiler :: Compiler Resource String | |
sassCompiler = getIdentifier >>> (unsafeCompiler $ compileSassString) | |
compressSassString :: Identifier a -> IO String | |
compressSassString = fmap compressCss . compressSassString | |
compileSassString :: Identifier a -> IO String | |
compileSassString ident = do | |
cmdResultList <- runResourceT $ [scmd|sass #{toFilePath ident}|] $$ consume | |
return $ (B.unpack . head) cmdResultList |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment