-
Notifications
You must be signed in to change notification settings - Fork 0
/
ase2css.hs
22 lines (19 loc) · 882 Bytes
/
ase2css.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module Main where
import Data.AdobeSwatchExchange.CSS (ase2css)
import Data.AdobeSwatchExchange (ASEBlock(CE), ColorEntry(colorName), AdobeSwatchExchange, blocks, getASE)
import qualified Data.ByteString.Lazy as B
import Data.Binary.Get (runGet)
import Language.Css.Pretty (pretty)
import System.Environment (getArgs)
import Text.PrettyPrint.HughesPJ (($+$), (<+>), doubleQuotes, text)
main :: IO ()
main =
do args <- getArgs
case args of
[inFile, outFile] ->
do c <- B.readFile inFile
let ase = runGet getASE c
css = text "/* Generated from" <+> doubleQuotes (text inFile) <+> text "using ase2css */" $+$
pretty (ase2css ase)
writeFile outFile $ show $ css
_ -> putStrLn "Usage: ase2css <infile.ase> <outfile.css>"