on master help sign in
static: Produce full filepaths when using hashed staticFilePath
commitda2e29c8336ed6097184326b6fcc255711b2805d authorAli Abrar <aliabrar@gmail.com> dateTue 29 Dec 2020, 23:40 (6 years ago) parentdc8656c
2 files changed+10−5
lib/asset/manifest/src-bin/static-th.hs+2−2 lib/asset/manifest/src/Obelisk/Asset/TH.hs+8−3
lib/asset/manifest/src-bin/static-th.hs+2−2
@@ -33,10 +33,10 @@ main = do
3333 , "static, staticFilePath :: FilePath -> Q Exp"
3434 , "#ifdef OBELISK_ASSET_PASSTHRU"
3535 , "static = staticAssetRaw"
36− , "staticFilePath = assetPathRaw \"static.out\""
36+ , "staticFilePath = staticAssetFilePathRaw \"static.out\""
3737 , "#else"
3838 , "static = staticAssetHashed " <> show root
39− , "staticFilePath = assetPath " <> show root
39+ , "staticFilePath = staticAssetFilePath " <> show root
4040 , "#endif"
4141 ]
4242 }
lib/asset/manifest/src/Obelisk/Asset/TH.hs+8−3
@@ -4,9 +4,10 @@ Description:
44-}
55module Obelisk.Asset.TH
66 ( assetPath
7− , assetPathRaw
87 , staticAssetRaw
98 , staticAssetHashed
9+ , staticAssetFilePath
10+ , staticAssetFilePathRaw
1011 ) where
1112
1213import Obelisk.Asset.Gather
@@ -36,5 +37,9 @@ staticAssetHashed :: FilePath -> FilePath -> Q Exp
3637staticAssetHashed root fp = do
3738 LitE . StringL . (staticPrefix </>) <$> hashedAssetFilePath root fp
3839
39−assetPathRaw :: FilePath -> FilePath -> Q Exp
40−assetPathRaw root fp = returnQ $ LitE $ StringL $ root </> fp
40+staticAssetFilePathRaw :: FilePath -> FilePath -> Q Exp
41+staticAssetFilePathRaw root fp = returnQ $ LitE $ StringL $ root </> fp
42+
43+staticAssetFilePath :: FilePath -> FilePath -> Q Exp
44+staticAssetFilePath root fp = do
45+ LitE . StringL . (root </>) <$> hashedAssetFilePath root fp