2

I am building a site with Hakyll and I only want my Google Analytics code to be included if I am deploying the site, not when I’m just testing it using “site server”. Ideally I’d be able to write something like

$if(deploying)$
    <script src=".../whatever.js"></script>
$endif$

in a template and have that content included when I run “site build” but not “site server”. Does Hakyll have any built-in way to determine which subcommand is being run? Or can I somehow access the process’s environment variables?

duplode
  • 33,731
  • 7
  • 79
  • 150
bdesham
  • 15,430
  • 13
  • 79
  • 123
  • 2
    This is potentially a nice feature request. Meanwhile, it might be possible to write a hack of some sort using [`getArgs`](https://hackage.haskell.org/package/base-4.8.1.0/docs/System-Environment.html#v:getArgs) from `System.Environment`. – duplode Aug 07 '15 at 10:10

0 Answers0