2016-01-13 94 views
1

我有這樣的常用目錄結構簡單耶索德項目:目錄結構耶索德和堆棧

./Main.hs 
./Foundation.hs 
./Handler/Home.hs 
./Handler/... etc 
./config/routes 
./templates/home.hamlet 
./templates/default-layout.hamlet 
./templates/default-layout-wrapper.hamlet 
./templates/default-layout-wrapper.cassius 
... 

我想建立這個項目組,其中典型的Main.hs程序是app目錄下。

我試圖將所有的Yesod結構放在app目錄下(app目錄是上面的.)。

項目的小集團文件看起來像這樣:

executable proj-web01-exe 
    hs-source-dirs:  app 
    main-is:    Main.hs 
    ghc-options:   -threaded -rtsopts -with-rtsopts=-N 
    build-depends:  base, bytestring, split, filepath 
        , stm, data-default, text, conduit, conduit-extra 
        , containers, resourcet, blaze-html, blaze-markup 
        , shakespeare, yesod, yesod-static 
        , proj-web01 
    default-language: Haskell2010 

現在,當我嘗試stack build,我收到以下錯誤信息:

[1 of 6] Compiling Foundation  (app/Foundation.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/proj-web01-exe/proj-web01-exe-tmp/Foundation.o) 

/home/me/proj-web01/app/Foundation.hs:46:35: 
    Exception when trying to run compile-time code: 
     Called widgetFileNoReload on "default-layout", but no templates were found. 
    Code: widgetFileNoReload (def) "default-layout" 
    In the splice: $(widgetFileNoReload def "default-layout") 

-- While building package proj-web01-0.1.0.0 using: 
     /home/me/.stack/setup-exe-cache/x86_64-linux/setup-Simple-Cabal-1.22.5.0-ghc-7.10.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.5.0 build lib:proj-web01 exe:proj-web01-exe --ghc-options " -ddump-hi -ddump-to-file" 
    Process exited with code: ExitFailure 1 

widgetFileNoReload不知道在哪裏可以找到「默認-layout「文件,位於app/templates目錄中。

我的問題:我應該以不同的方式編寫cabal文件,還是應該將模板,Handler ...文件夾放置在別處(例如在src中)?什麼是使用堆棧時最自然的目錄結構?或者,如何設置堆棧參數(cabal和yaml文件)以適應通常的Yesod目錄結構?

回答

1

如果你採用標準的Yesod腳手架,它應該與Stack毫無問題地進行編譯(事實上,我現在正在做這件事)。我建議不要移動腳手架文件,直到熟悉設置。如果你真的想移動源文件,我建議將模板保留在原始位置。