forked from HeinrichApfelmus/threepenny-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use file-embed package to load resources. HeinrichApfelmus#148
The use of `makeRelativeToProject` might make the library easier to install with stack in some cases. Do not use QuasiQuotes, but ordinary TemplateHaskell.
- Loading branch information
1 parent
e39b447
commit 6cf291b
Showing
3 changed files
with
21 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
{-# LANGUAGE QuasiQuotes #-} | ||
{-# LANGUAGE TemplateHaskell #-} | ||
module Foreign.JavaScript.Resources where | ||
|
||
import Data.Text (Text) | ||
import qualified Data.Text as Text | ||
import Foreign.JavaScript.Include | ||
|
||
jsDriverCode :: Maybe String -> Text | ||
jsDriverCode dict = Text.unlines $ map Text.pack | ||
[ [include|js/lib/jquery.js|] | ||
, [include|js/lib/jquery-cookie.js|] | ||
, "var Haskell = { };" ++ maybe "" (\dict -> "dict = \""++ dict++ "\";") dict | ||
, [include|js/comm.js|] | ||
, [include|js/ffi.js|] | ||
, [include|js/lib.js|] | ||
, [include|js/log.js|] | ||
|
||
jsDriverCode :: Text | ||
jsDriverCode = Text.unlines $ map Text.pack | ||
[ $(include "js/lib/jquery.js") | ||
, $(include "js/lib/jquery-cookie.js") | ||
, "var Haskell = {};" ++ maybe "" (\dict -> "dict = \""++ dict++ "\";") dict | ||
, $(include "js/comm.js") | ||
, $(include "js/ffi.js") | ||
, $(include "js/lib.js") | ||
, $(include "js/log.js") | ||
] | ||
|
||
cssDriverCode :: Text | ||
cssDriverCode = Text.pack [include|js/haskell.css|] | ||
cssDriverCode = Text.pack $(include "js/haskell.css") | ||
|
||
defaultHtmlFile :: Text | ||
defaultHtmlFile = Text.pack [include|js/index.html|] | ||
defaultHtmlFile = Text.pack $(include "js/index.html") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters