@@ -15,14 +15,11 @@ main = do
15 , _simplePkg_moduleName = T.pack moduleName
15 , _simplePkg_moduleName = T.pack moduleName
16 , _simplePkg_dependencies = map T.pack
16 , _simplePkg_dependencies = map T.pack
19 , "obelisk-asset-manifest"
18 , "obelisk-asset-manifest"
20 , "template-haskell"
19 , "template-haskell"
22 , _simplePkg_moduleContents = T.pack $ unlines
21 , _simplePkg_moduleContents = T.pack $ unlines
23− [ "{-# Language BangPatterns #-}"
22+ [ "{-# Language CPP #-}"
24− , "{-# Language CPP #-}"
25− , "{-# Language OverloadedStrings #-}"
27 , " Description:"
24 , " Description:"
28 , " Automatically generated module that provides the 'static' TH function"
25 , " Automatically generated module that provides the 'static' TH function"
@@ -30,29 +27,14 @@ main = do
31 , "module " <> moduleName <> " ( static ) where"
28 , "module " <> moduleName <> " ( static ) where"
33− , "import Obelisk.Asset.Gather"
30+ , "import Obelisk.Asset.TH"
34 , "import Language.Haskell.TH"
31 , "import Language.Haskell.TH"
35− , "import Language.Haskell.TH.Syntax"
36− , "import System.FilePath"
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)"
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"
48− , "prefix :: FilePath"
49− , "prefix = \"/static\""
51 , "static :: FilePath -> Q Exp"
33 , "static :: FilePath -> Q Exp"
52− , "#ifdef PASSTHRU"
34+ , "#ifdef OBELISK_ASSET_PASSTHRU"
53− , "static = assetPathRaw"
35+ , "static = staticAssetRaw"
55− , "static = assetPath " <> show root
37+ , "static = staticAssetHashed " <> show root
56 , "#endif"
38 , "#endif"