1

I'm new to Haskell and thought I would start by making a blog with Hakyll. I'm also using gulp for pre-processing my js and scss.

How do I go about generating my js and css files when I build my Hakyll site?

gxc
  • 4,946
  • 6
  • 37
  • 55

1 Answers1

1

I think the key to finding your solution would be using clay with hakyll in the section of integrating clay we have

match "css/*.hs" $ do
    route   $ setExtension "css"
    compile $ getResourceString >>= withItemBody (unixFilter "runghc" [])

-- cabal sandbox users can use (unixFilter "cabal" ["exec", "runghc"])
-- given that you've added cabal to your PATH

I think you can replace the "runghc" [] part with the according "gulp" ["buildcss"] and add another section match "js/*.js

match "css/*.scss" $ do
        route   $ setExtension "css"
        compile $ getResourceString >>= withItemBody (unixFilter "gulp" ["buildcss"])

match "js/*.js" $ do
            route   $ setExtension "js"
            compile $ getResourceString >>= withItemBody (unixFilter "gulp" ["buildjs"])

Note: this code is untested for I don't use gulp in my setup.

epsilonhalbe
  • 15,637
  • 5
  • 46
  • 74