Search code examples
javascripthaskellyesod

How to include many julius files in a single page


I currently have a route in my app which look like :

getBookmarksR :: Handler Html
getBookmarksR = do
    defaultLayout $ do
      setTitle "Bookmarks"
      addScript $ StaticR js_jquery_1_10_2_js
      addScript $ StaticR js_handlebars_1_1_2_js
      addScript $ StaticR js_ember_1_2_0_js
      addScript $ StaticR js_ember_data_js
      $(widgetFile "bookmarks")

It include ember and its dependencies.

So now I want to develop the rest of the javascript using Yesod's Julius. But for now the only file I can work with is templates/bookmarks.julius because it is loaded automatically by $(widgetFile "bookmarks")

So how can I integrate many julius file in a way to split my code between many files ?


Solution

  • You can use:

    toWidget $(juliusFile "templates/foo.julius")
    

    But often times, I'll just use $(widgetFile "foo"). If there are no foo.hamlet, foo.lucius, or foo.cassius files, it works out to the same thing.