module Rules.Src.JavaScript (
rules
) where
import Hakyll
import System.FilePath (joinPath)
import Media (compressJsCompiler)
import Media.TS (compileTypeScriptCompiler)
rules :: Rules ()
rules :: Rules ()
rules = do
Pattern -> Rules () -> Rules ()
match Pattern
tsPath (Rules () -> Rules ()) -> Rules () -> Rules ()
forall a b. (a -> b) -> a -> b
$ do
Routes -> Rules ()
route (Routes -> Rules ()) -> Routes -> Rules ()
forall a b. (a -> b) -> a -> b
$ String -> (String -> String) -> Routes
gsubRoute String
"contents/ts/" (String -> String -> String
forall a b. a -> b -> a
const String
"js/") Routes -> Routes -> Routes
`composeRoutes` String -> Routes
setExtension String
"js"
Compiler (Item String) -> Rules ()
forall a.
(Binary a, Typeable a, Writable a) =>
Compiler (Item a) -> Rules ()
compile Compiler (Item String)
compileTypeScriptCompiler
Pattern -> Rules () -> Rules ()
match Pattern
jsPath (Rules () -> Rules ()) -> Rules () -> Rules ()
forall a b. (a -> b) -> a -> b
$ do
Routes -> Rules ()
route (Routes -> Rules ()) -> Routes -> Rules ()
forall a b. (a -> b) -> a -> b
$ String -> (String -> String) -> Routes
gsubRoute String
"contents/" ((String -> String) -> Routes) -> (String -> String) -> Routes
forall a b. (a -> b) -> a -> b
$ String -> String -> String
forall a b. a -> b -> a
const String
forall a. Monoid a => a
mempty
Compiler (Item String) -> Rules ()
forall a.
(Binary a, Typeable a, Writable a) =>
Compiler (Item a) -> Rules ()
compile Compiler (Item String)
compressJsCompiler
where
tsPath :: Pattern
tsPath = String -> Pattern
fromGlob (String -> Pattern) -> String -> Pattern
forall a b. (a -> b) -> a -> b
$ [String] -> String
joinPath [String
"contents", String
"ts", String
"**"]
jsPath :: Pattern
jsPath = String -> Pattern
fromGlob (String -> Pattern) -> String -> Pattern
forall a b. (a -> b) -> a -> b
$ [String] -> String
joinPath [String
"contents", String
"js", String
"**"]