I need to run npm install && gulp build
inside my static/semantic-ui
folder, so it creates the needed css
file.
I saw this example with Setup.hs, however on my scaffolded project I don't have it, so my question where is the right place to put the code to run those bash commands.
If you're using the default Yesod scaffolding (generated by stack
tool), then it indeed doesn't contain Setup.hs
(which is a bit weird, as their own guide - https://github.com/commercialhaskell/stack/blob/master/doc/GUIDE.md - recommends having it as a good practice)
Setup.hs
should be located in main project directory (same where stack.yml
and yourproject.cabal
are located) and content should be roughly the same as in your included example (defaultMainWithHooks
is the key part).
Details of hooks usage are specified in https://www.haskell.org/cabal/users-guide/developing-packages.html and in cabal
spec: https://hackage.haskell.org/package/Cabal-1.24.0.0/docs/Distribution-Simple.html
BTW, for now stack
doesn't support pre-build hooks on its own (for details see: https://github.com/commercialhaskell/stack/issues/503), so you have to stick to ones provided by cabal
- that's where Setup.hs
comes from.