-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathase2less.hs
More file actions
20 lines (18 loc) · 834 Bytes
/
ase2less.hs
File metadata and controls
20 lines (18 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module Main where
import Data.AdobeSwatchExchange.LESS (ase2less)
import Data.AdobeSwatchExchange (ASEBlock(CE), ColorEntry(colorName), AdobeSwatchExchange, blocks, getASE)
import qualified Data.ByteString.Lazy as B
import Data.Binary.Get (runGet)
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
less = text "/* Generated from" <+> doubleQuotes (text inFile) <+> text "using ase2less */" $+$
ase2less ase
writeFile outFile $ show $ less
_ -> putStrLn "Usage: ase2css <infile.ase> <outfile.less>"