@@ -15,14 +15,11 @@ main = do
1515 , _simplePkg_moduleName = T.pack moduleName
1616 , _simplePkg_dependencies = map T.pack
1717 [ "base"
18− , "filepath"
1918 , "obelisk-asset-manifest"
2019 , "template-haskell"
2120 ]
2221 , _simplePkg_moduleContents = T.pack $ unlines
23− [ "{-# Language BangPatterns #-}"
24− , "{-# Language CPP #-}"
25− , "{-# Language OverloadedStrings #-}"
22+ [ "{-# Language CPP #-}"
2623 , "{-|"
2724 , " Description:"
2825 , " Automatically generated module that provides the 'static' TH function"
@@ -30,29 +27,14 @@ main = do
3027 , "-}"
3128 , "module " <> moduleName <> " ( static ) where"
3229 , ""
33− , "import Obelisk.Asset.Gather"
30+ , "import Obelisk.Asset.TH"
3431 , "import Language.Haskell.TH"
35− , "import Language.Haskell.TH.Syntax"
36− , "import System.FilePath"
37− , ""
38− , "-- | Produces a string literal with the hashed path of the file"
39− , "assetPath :: FilePath -> FilePath -> Q Exp"
40− , "assetPath root relativePath = do"
41− , " qAddDependentFile $ root </> relativePath"
42− , " LitE . StringL . (prefix</>) <$> runIO (toHashedPath root relativePath)"
43− , ""
44− , "-- | Produces a string literal with the raw (i.e., unhashed) path of the file"
45− , "assetPathRaw :: FilePath -> Q Exp"
46− , "assetPathRaw fp = returnQ $ LitE $ StringL $ prefix </> fp"
47− , ""
48− , "prefix :: FilePath"
49− , "prefix = \"/static\""
5032 , ""
5133 , "static :: FilePath -> Q Exp"
52− , "#ifdef PASSTHRU"
53− , "static = assetPathRaw"
34+ , "#ifdef OBELISK_ASSET_PASSTHRU"
35+ , "static = staticAssetRaw"
5436 , "#else"
55− , "static = assetPath " <> show root
37+ , "static = staticAssetHashed " <> show root
5638 , "#endif"
5739 ]
5840 }